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

Unable to push Docker images due to failing image ID length check

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • docker-commons-plugin
    • Jenkins v1.642.1
      Docker Commons Plugin v1.2
      CloudBees Docker Build and Publish plugin v1.1

      Docker v1.10.0 introduced a new format for image IDs whereby they now have a prefix of sha256: before the hash. See https://github.com/docker/docker/pull/17924 under Summary of UI Changes:

      Full-length image IDs have a sha256: prefix. This prefix is hidden for truncated image IDs for convenience.

      This is causing my jobs that rely on building and pushing Docker images to fail. It builds the image fine, but when it goes to push it to the repository it apparently first validates the image ID by making sure it's a string with a length of 64. The length check is now failing, since the full image ID now contains the sha256: prefix.

      The relevant file and line where this check is occurring is /src/main/java/org/jenkinsci/plugins/docker/commons/fingerprint/DockerFingerprints.java#L64

      The error in my build log is:

      ...
      Successfully built 8d6d5e96d600
      [api-dev] $ docker inspect 8d6d5e96d600
      ERROR: Build step failed with exception
      java.lang.IllegalArgumentException: Expecting 64-char full image ID, but got sha256:2f469c13a10a9950c6c5ed4d5cccd6f7b13e2a7516a62103d98e98a838e60d1a
      	at org.jenkinsci.plugins.docker.commons.fingerprint.DockerFingerprints.getFingerprintHash(DockerFingerprints.java:65)
      	at org.jenkinsci.plugins.docker.commons.fingerprint.DockerFingerprints.forDockerInstance(DockerFingerprints.java:141)
      	at org.jenkinsci.plugins.docker.commons.fingerprint.DockerFingerprints.forImage(DockerFingerprints.java:108)
      	at org.jenkinsci.plugins.docker.commons.fingerprint.DockerFingerprints.forImage(DockerFingerprints.java:93)
      	at org.jenkinsci.plugins.docker.commons.fingerprint.DockerFingerprints.addFromFacet(DockerFingerprints.java:253)
      	at com.cloudbees.dockerpublish.DockerBuilder$Perform.processFingerprints(DockerBuilder.java:467)
      	at com.cloudbees.dockerpublish.DockerBuilder$Perform.buildAndTag(DockerBuilder.java:339)
      	at com.cloudbees.dockerpublish.DockerBuilder$Perform.exec(DockerBuilder.java:274)
      	at com.cloudbees.dockerpublish.DockerBuilder$Perform.access$100(DockerBuilder.java:254)
      	at com.cloudbees.dockerpublish.DockerBuilder.perform(DockerBuilder.java:225)
      	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782)
      	at hudson.model.Build$BuildExecution.build(Build.java:205)
      	at hudson.model.Build$BuildExecution.doRun(Build.java:162)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
      	at hudson.model.Run.execute(Run.java:1738)
      	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      	at hudson.model.ResourceController.execute(ResourceController.java:98)
      	at hudson.model.Executor.run(Executor.java:410)
      Build step 'Docker Build and Publish' marked build as failure
      Finished: FAILURE
      

      I'm not sure what the usefulness of the length check is, but it should either be removed or updated to account for the new prefix in the full image ID.

            csanchez Carlos Sanchez
            theartoflogic Sarah Ryan
            Votes:
            2 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: