Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-46321

JSONException: null object when 'auths' key is not exist in .docker/config.json file.

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Minor Minor
    • docker-commons-plugin
    • None
    • Jenkins ver. 2.73
      Docker Commons Plugin v1.8
      Docker Build and Publish plugin v1.3.2

      If there is config file for docker at `~/.docker/config.json` and no `auths` key in the file, this plugin throws 'JSONException: null object'

      This exception needs to be avoided.

       

      ERROR: Build step failed with exception
      net.sf.json.JSONException: null object
      	at net.sf.json.JSONObject.verifyIsNull(JSONObject.java:2688)
      	at net.sf.json.JSONObject.element(JSONObject.java:1733)
      	at net.sf.json.JSONObject.element(JSONObject.java:1716)
      	at net.sf.json.JSONObject.put(JSONObject.java:2328)
      	at org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryToken$1.call(DockerRegistryToken.java:109)
      	at org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryToken$1.call(DockerRegistryToken.java:82)
      	at hudson.remoting.LocalChannel.call(LocalChannel.java:45)
      	at org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryToken.newKeyMaterialFactory(DockerRegistryToken.java:82)
      	at org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryEndpoint.newKeyMaterialFactory(DockerRegistryEndpoint.java:219)
      	at org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryEndpoint.newKeyMaterialFactory(DockerRegistryEndpoint.java:204)
      	at org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryEndpoint.newKeyMaterialFactory(DockerRegistryEndpoint.java:196)
      	at com.cloudbees.dockerpublish.DockerBuilder$Perform.executeCmd(DockerBuilder.java:455)
      	at com.cloudbees.dockerpublish.DockerBuilder$Perform.executeCmd(DockerBuilder.java:431)
      	at com.cloudbees.dockerpublish.DockerBuilder$Perform.buildAndTag(DockerBuilder.java:373)
      	at com.cloudbees.dockerpublish.DockerBuilder$Perform.exec(DockerBuilder.java:311)
      	at com.cloudbees.dockerpublish.DockerBuilder$Perform.access$100(DockerBuilder.java:291)
      	at com.cloudbees.dockerpublish.DockerBuilder.perform(DockerBuilder.java:262)
      	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:730)
      	at hudson.model.Build$BuildExecution.build(Build.java:206)
      	at hudson.model.Build$BuildExecution.doRun(Build.java:163)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:490)
      	at hudson.model.Run.execute(Run.java:1737)
      	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      	at hudson.model.ResourceController.execute(ResourceController.java:97)
      	at hudson.model.Executor.run(Executor.java:419)
      

          [JENKINS-46321] JSONException: null object when 'auths' key is not exist in .docker/config.json file.

          stephen moon created issue -
          stephen moon made changes -
          Description Original: If there is config file for docker in `~/.docker/config.json` and no `auths` key in the file, this plugin throws 'JSONException: null object'

          This exception needs to be avoided.

           
          {code:java}
          ERROR: Build step failed with exception
          net.sf.json.JSONException: null object
          at net.sf.json.JSONObject.verifyIsNull(JSONObject.java:2688)
          at net.sf.json.JSONObject.element(JSONObject.java:1733)
          at net.sf.json.JSONObject.element(JSONObject.java:1716)
          at net.sf.json.JSONObject.put(JSONObject.java:2328)
          at org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryToken$1.call(DockerRegistryToken.java:109)
          at org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryToken$1.call(DockerRegistryToken.java:82)
          at hudson.remoting.LocalChannel.call(LocalChannel.java:45)
          at org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryToken.newKeyMaterialFactory(DockerRegistryToken.java:82)
          at org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryEndpoint.newKeyMaterialFactory(DockerRegistryEndpoint.java:219)
          at org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryEndpoint.newKeyMaterialFactory(DockerRegistryEndpoint.java:204)
          at org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryEndpoint.newKeyMaterialFactory(DockerRegistryEndpoint.java:196)
          at com.cloudbees.dockerpublish.DockerBuilder$Perform.executeCmd(DockerBuilder.java:455)
          at com.cloudbees.dockerpublish.DockerBuilder$Perform.executeCmd(DockerBuilder.java:431)
          at com.cloudbees.dockerpublish.DockerBuilder$Perform.buildAndTag(DockerBuilder.java:373)
          at com.cloudbees.dockerpublish.DockerBuilder$Perform.exec(DockerBuilder.java:311)
          at com.cloudbees.dockerpublish.DockerBuilder$Perform.access$100(DockerBuilder.java:291)
          at com.cloudbees.dockerpublish.DockerBuilder.perform(DockerBuilder.java:262)
          at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
          at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:730)
          at hudson.model.Build$BuildExecution.build(Build.java:206)
          at hudson.model.Build$BuildExecution.doRun(Build.java:163)
          at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:490)
          at hudson.model.Run.execute(Run.java:1737)
          at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
          at hudson.model.ResourceController.execute(ResourceController.java:97)
          at hudson.model.Executor.run(Executor.java:419)
          {code}
          New: If there is config file for docker at `~/.docker/config.json` and no `auths` key in the file, this plugin throws 'JSONException: null object'

          This exception needs to be avoided.

           
          {code:java}
          ERROR: Build step failed with exception
          net.sf.json.JSONException: null object
          at net.sf.json.JSONObject.verifyIsNull(JSONObject.java:2688)
          at net.sf.json.JSONObject.element(JSONObject.java:1733)
          at net.sf.json.JSONObject.element(JSONObject.java:1716)
          at net.sf.json.JSONObject.put(JSONObject.java:2328)
          at org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryToken$1.call(DockerRegistryToken.java:109)
          at org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryToken$1.call(DockerRegistryToken.java:82)
          at hudson.remoting.LocalChannel.call(LocalChannel.java:45)
          at org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryToken.newKeyMaterialFactory(DockerRegistryToken.java:82)
          at org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryEndpoint.newKeyMaterialFactory(DockerRegistryEndpoint.java:219)
          at org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryEndpoint.newKeyMaterialFactory(DockerRegistryEndpoint.java:204)
          at org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryEndpoint.newKeyMaterialFactory(DockerRegistryEndpoint.java:196)
          at com.cloudbees.dockerpublish.DockerBuilder$Perform.executeCmd(DockerBuilder.java:455)
          at com.cloudbees.dockerpublish.DockerBuilder$Perform.executeCmd(DockerBuilder.java:431)
          at com.cloudbees.dockerpublish.DockerBuilder$Perform.buildAndTag(DockerBuilder.java:373)
          at com.cloudbees.dockerpublish.DockerBuilder$Perform.exec(DockerBuilder.java:311)
          at com.cloudbees.dockerpublish.DockerBuilder$Perform.access$100(DockerBuilder.java:291)
          at com.cloudbees.dockerpublish.DockerBuilder.perform(DockerBuilder.java:262)
          at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
          at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:730)
          at hudson.model.Build$BuildExecution.build(Build.java:206)
          at hudson.model.Build$BuildExecution.doRun(Build.java:163)
          at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:490)
          at hudson.model.Run.execute(Run.java:1737)
          at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
          at hudson.model.ResourceController.execute(ResourceController.java:97)
          at hudson.model.Executor.run(Executor.java:419)
          {code}
          Jesse Glick made changes -
          Link New: This issue relates to JENKINS-38018 [ JENKINS-38018 ]
          Jesse Glick made changes -
          Component/s New: docker-commons-plugin [ 20628 ]
          Component/s Original: docker-build-publish-plugin [ 18624 ]

          Jesse Glick added a comment -

          Do not plan to work on that since the new APIs normally call docker login and do not use that code path.

          Jesse Glick added a comment - Do not plan to work on that since the new APIs normally call docker login and do not use that code path.
          Jesse Glick made changes -
          Resolution New: Won't Fix [ 2 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]

          Jesse Glick added a comment -

          Jesse Glick added a comment - See JENKINS-51407 .
          Jesse Glick made changes -
          Link New: This issue relates to JENKINS-51407 [ JENKINS-51407 ]

            csanchez Carlos Sanchez
            shyr stephen moon
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: