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
- jf cli version: 2.51.1
- build name:
lib-systest
- build number:
feature/JIRA_ID-1
- format: branch-jenkinsBuildNo
Command:
jf rt bpr "lib-systest" "feature/JIRA_ID-1" \
maven-release-local \
--source-repo maven-dev-virtual \
--status "Released" \
--copy
Result:
[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'."
}
]
}
- name is not
lib-systest/feature
butlib-systest
- number is not
JIRA_ID-1
butfeature/JIRA_ID-1
Attempts
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.
Workaround options
- change the naming convention to never use '/' in a version `.replaceAll('/', '-') - that would required touching 1000s of repositories for me.
- write a python script REST replacement for the
jf rt bpr
command as then I'll have control over promotion args - find an aql way to execute a promotion as AQL filters can handle '/' in the number
At 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
Jenkins Shared Library Excerpt
The following is groovy code.
The
-X POST "url"
handles URL escaping properly