Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI not replacing forward slashes with " :: " string for JOB_NAME same as current plugin #49

Open
lweitzel01 opened this issue Mar 9, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@lweitzel01
Copy link

Describe the bug

When using the current artifactory jenkins plugin in a freestyle job or pipeline jobs, the build name (coming from the jenkins JOB_NAME variable) when published has all the "/" characters replaced with the string " :: ". So for example a jenkins JOB_NAME of "sample/job" would show as "sample :: job" in the build name in Artifactory.

When using the jf CLI however, it looks like it is not applying the same conversion to the --build_name parameter. So the build name still has the "/" characters if uploaded with jf command line and converted to " :: " when using the plugin.

Can the jf CLI be configured to do the same string conversion on the build_name so it behaves the same way as the pipeline code and the legacy jenkins plugin??

Current behavior

Forward slashes in build-name are NOT converted to " :: "

Reproduction steps

Pass --build_name=sample/job parameter to jf upload command

Expected behavior

Expected build-name parameter to have "/" converted to " :: " to behave the same as the current freestyle plugin and jenkins pipeline code

JFrog CLI version

2.34.1

Operating system type and version

Windows and Unix

JFrog Artifactory version

7.49.8

JFrog Xray version

No response

@lweitzel01 lweitzel01 added the bug Something isn't working label Mar 9, 2023
@yahavi yahavi transferred this issue from jfrog/jfrog-cli Mar 12, 2023
@yahavi
Copy link
Member

yahavi commented Mar 12, 2023

@lweitzel01 thanks for using the Jenkins JFrog plugin!

The replacement from / to :: in the old Jenkins Artifactory plugin was dedicated to resolving issues we think don't exist anymore. The JFrog CLI is powerful enough to handle all edge cases.

You can still set the JFROG_CLI_BUILD_NAME environment variable to your desired value. For example, to get the same behavior as it was in the old Artifactory plugin, do the following:

environment {
    JFROG_CLI_BUILD_NAME = "${env.JOB_NAME}".replace('/', ' :: ')
}

Please let us know what you think.

@lweitzel01
Copy link
Author

Yahav,

Thanks for the response. I currently have Case #240622 open for this issue with JFrog.

Within our enterprise we have many application using the current pipeline plugins and teams using freestyle jobs. They are currently not using the JF CLI so the above solution would not work. For the teams that I need to move to using the JF command, I was really hoping that there could be some kind of switch added to the command line to mimc the behavior. This would be preferrable to having teams add extra environment variables with string replacements and then our build names across the enterprise could still be consistent regardless of the method used.

Our existing build patterns in permissons also utilize the " :; " nomenclature which make migrating to "/" difficult.

There is also an existing bug in the CLI which crashes when the "/" command is used which has still not been corrected. ((XRAY-11984). The solution is to use the deprecated jf rt build-scan syntax. However, once that no longer functions, than I would have to have teams make a change again. Adding this functionality to the jf CLI would allow me to roll this out to our enterprise now and not have to make a change again in the near future.

Any chance this could be added to the JF command?

@enaess
Copy link

enaess commented Aug 4, 2023

The other think I've noticed with using :: in the build-name is that artifacts had issues navigating back and forth between the artifact and the build itself. Though this was an older version of artifactory, so ... it may already have been fixed.

As a result of this, we've gone with naming our projects limiting the name to ' ' and '-' and avoiding special characters like ::, & or / \

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants