When I run a promotion on a build with a complex build number, the cli seems to view the '/' as a break resulting in failure to find the build
lib-systest
feature/JIRA_ID-1
jf rt bpr "lib-systest" "feature/JIRA_ID-1" \
maven-release-local \
--source-repo maven-dev-virtual \
--status "Released" \
--copy
[Info] Promoting build...
[Error] server response: 404
{
"errors": [
{
"status": 404,
"message": "Cannot find builds by the name 'lib-systest/feature'
and the number 'JIRA_ID-1' and buildRepo 'artifactory-build-info'."
}
]
}
lib-systest/feature
but lib-systest
JIRA_ID-1
but feature/JIRA_ID-1
I've tried the following escaping approaches and none seem to work
"feature\/JIRA_ID-1"
"feature\\/JIRA_ID-1"
"feature%2FJIRA_ID-1"
"feature :: JIRA_ID-1"
I've opened a support ticket and I'm hoping someone else had this issue and found a workaround.
jf rt bpr
command as then I'll have control over promotion argsAt present, Jfrog has what I believe is a bug (see https://github.com/jfrog/jfrog-cli/issues/2330)
But, it is easy to work around the problem with
The following is groovy code.
// Generate Payload
def payload = [
'status': "Released",
'ciUser': 'jenkins',
'dryRun': false,
'targetRepo': "gradle-release-local",
/* equivalent to `--copy` from jf rt bpr */
'artifacts': true,
'dependencies': true
]
jsonHandler.writeJson(payload, 'payload.json')
// Call API via curl
steps.sh(script: """
set +x
curl \
-H "Authorization: Bearer ${IdentityToken}" \
-H "Content-type:application/json" \
--data-binary @promote.json \
-X POST "${artifactoryServerUrl}/api/build/promote/lib-systest/feature%2FJIRA_ID-1"
set -x
""", returnStdout: true).trim()
The -X POST "url"
handles URL escaping properly