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

[JENKINS-46321] Avoid 'JSONException: null object' when no key 'auths' exist in .docker/config.json #59

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

shyr
Copy link

@shyr shyr commented Aug 21, 2017

To avoid 'JSONException: null object' error, if there is no key 'auths' in the config.json file, this PR adds that key and writes it to the file in advance.

Even though there is no 'auths' key at config.json file, docker client adds it when it is needed.
This plugin should be able to avoid that situation, too.

@shyr
Copy link
Author

shyr commented Sep 26, 2017

Please take a look.

Copy link
Member

@oleg-nenashev oleg-nenashev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, CC @jglick

if (auths.isNullObject()) {
auths = new JSONObject();
json.put("auths", auths);
FileUtils.writeStringToFile(config, json.toString(2), "UTF-8");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add some logic on the FINE/CONFIG level here. It is just a data migration logic IIUC

@jglick
Copy link
Member

jglick commented Oct 10, 2017

Might be better than nothing (no idea, really) but JENKINS-46321 would just disappear if JENKINS-38018 were done instead.

@jglick
Copy link
Member

jglick commented Feb 16, 2018

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 docker login.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants