[JENKINS-46321] Avoid 'JSONException: null object' when no key 'auths' exist in .docker/config.json#59
Open
shyr wants to merge 1 commit intojenkinsci:masterfrom
Open
[JENKINS-46321] Avoid 'JSONException: null object' when no key 'auths' exist in .docker/config.json#59shyr wants to merge 1 commit intojenkinsci:masterfrom
shyr wants to merge 1 commit intojenkinsci:masterfrom
Conversation
Author
|
Please take a look. |
oleg-nenashev
approved these changes
Sep 26, 2017
| if (auths.isNullObject()) { | ||
| auths = new JSONObject(); | ||
| json.put("auths", auths); | ||
| FileUtils.writeStringToFile(config, json.toString(2), "UTF-8"); |
Member
There was a problem hiding this comment.
I would add some logic on the FINE/CONFIG level here. It is just a data migration logic IIUC
Member
|
Might be better than nothing (no idea, really) but JENKINS-46321 would just disappear if JENKINS-38018 were done instead. |
Member
|
Likely unnecessary after #67, though could still apply to corner cases such as users of the Google container registry which cannot be handled by a simple |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
To avoid 'JSONException: null object' error, if there is no key 'auths' in the
config.jsonfile, this PR adds that key and writes it to the file in advance.Even though there is no 'auths' key at
config.jsonfile, docker client adds it when it is needed.This plugin should be able to avoid that situation, too.