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

Using the library silently upgrades local configuration to version 3, which makes it unusable for "jfrog" command #24

Open
jhinrichsen opened this issue Oct 19, 2020 · 8 comments
Labels
bug Something isn't working

Comments

@jhinrichsen
Copy link

Describe the bug
I have a working JFrog CLI configuration in $HOME/.jfrog/jfrog-cli.conf on our CI/CD server. We are making heavy use of 'jfrog' command in lots of pipelines. As soon as one single pipeline uses the new 'jfrog-cli-core' library instead of relying on an external command, the library silently converts the configuration from version 1 to version 3, making it useless for 'jfrog':

[Error] unexpected end of JSON input

To Reproduce

  • create a local configuration $HOME/.jfrog/jfrog-cli.conf
  • run 'jfrog rt ping' to make sure it is working
  • run any program that makes use of jfrog-cli-core
  • run 'jfrog rt ping' again

Expected behavior
library should not break existing configuration. I mean thats what the 'Version' in jfrog-cli.conf is for, no?

Screenshots
If applicable, add screenshots to help explain your problem.

Versions

  • JFrog CLI core version: 1.0.2
  • JFrog CLI version (if applicable): 1.36.0
  • Artifactory version: 6.11.7 rev 61107900

Additional context
Add any other context about the problem here.

@jhinrichsen jhinrichsen added the bug Something isn't working label Oct 19, 2020
@eyalbe4
Copy link
Contributor

eyalbe4 commented Oct 19, 2020

@jhinrichsen,
I understand that you have multiple pipelines, which use different versions of JFrog CLI and all of these pipelines use the same JFrog CLI configuration.
To get this issue resolved, do you see an issue with upgrading JFrog CLI to the latest version for all pipelines?
We haven't considered a case where different versions of JFrog CLI's will use the same config directory. The idea was to upgrade the configuration, with the requirements of the new release. The version property inside the config is used to determine whether the config needs to be upgraded or not.
Can you please share with us more info about the reason why multiple versions of JFrog CLI are used? This may help us better understand the problem and consider possible solutions.
Thanks.

@jhinrichsen
Copy link
Author

No, if a pipelines uses the JFrog CLI the one and only version is 1.36.0. However, the first pipeline uses jfrog-cli-core library instead of jfrog executable, which updates the config and makes it unusable for jfrog executable.

@jhinrichsen
Copy link
Author

Not sure but I guess the update is part of https://pkg.go.dev/github.com/jfrog/jfrog-cli-core/utils/config#GetDefaultArtifactoryConf. At least the documentation does not suggest "oh, and as a side effect, it will rewrite your local config to V3 which effectively renders jfrog executable useless" ;-)

@eyalbe4
Copy link
Contributor

eyalbe4 commented Oct 19, 2020

@jhinrichsen,
When you say "the first pipeline uses jfrog-cli-core library" - do you know how the pipeline uses the jfrog-cli-core library? Is it through another go application which depends on jfrog-cli-core? Is this another CLI?

@jhinrichsen
Copy link
Author

jhinrichsen commented Oct 19, 2020

Yes, the Go library jfrog-cli-core is used by an inhouse Go program other than the JFrog CLI executable.

Compared to git, trivial pipelines use the commandline executable 'git', while more advanced requirements that require custom logic use libgit2.

@eyalbe4
Copy link
Contributor

eyalbe4 commented Oct 19, 2020

I see @jhinrichsen.

I guess that for future config upgrades, we can design the config migration mechanism to support multiple config versions, by simply keeping a copy of the old config, so that older versions can use it.
This may mean though that adding a server to the old config, will not be reflected in the new config. Let me know what you think about adopting this approach,

In the meantime, to resolve the issue, will you be able to upgrade the version of JFrog CLI to the latest, in all pipelines?

@jhinrichsen
Copy link
Author

An upgrade of jfrog executable resolves the issue.

@eyalbe4
Copy link
Contributor

eyalbe4 commented Jan 4, 2021

I'm glad to hear this @jhinrichsen! Thanks for the update.
We made the config upgrade backward compatible, by copying the config to a new file, which is used by the new version only.
Feel free to close this issue.

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

2 participants