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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: docker-commons-plugin
    • Labels:
    • Environment:
      Jenkins v1.642.1
      Docker Commons Plugin v1.2
      CloudBees Docker Build and Publish plugin v1.1
    • Similar Issues:

      Description

      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.

        Attachments

          Issue Links

            Activity

            theartoflogic Sarah Ryan created issue -
            Hide
            theartoflogic Sarah Ryan added a comment -

            I've attached a simple patch that just checks for the prefix and removes it from the id before continuing as normal. This should be backwards compatible, since Docker pre-v1.10.0 image IDs will just skip the removal of the prefix with no changes.

            I'm not sure if there needs to be a more robust (and possibly future proof?) solution though.

            Show
            theartoflogic Sarah Ryan added a comment - I've attached a simple patch that just checks for the prefix and removes it from the id before continuing as normal. This should be backwards compatible, since Docker pre-v1.10.0 image IDs will just skip the removal of the prefix with no changes. I'm not sure if there needs to be a more robust (and possibly future proof?) solution though.
            theartoflogic Sarah Ryan made changes -
            Field Original Value New Value
            Attachment 0001-Fix-docker-1.10-issue-due-to-new-image-ID-format.patch [ 31771 ]
            theartoflogic Sarah Ryan made changes -
            Remote Link This issue links to "Jira Pull Request (Web Link)" [ 13793 ]
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Sarah Ryan
            Path:
            src/main/java/org/jenkinsci/plugins/docker/commons/fingerprint/DockerFingerprints.java
            http://jenkins-ci.org/commit/docker-commons-plugin/8d947ca5e2203fb43d92cf6ddb6b9464a153da50
            Log:
            JENKINS-32792 - Added check for "sha256:" prefix in image ID

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Sarah Ryan Path: src/main/java/org/jenkinsci/plugins/docker/commons/fingerprint/DockerFingerprints.java http://jenkins-ci.org/commit/docker-commons-plugin/8d947ca5e2203fb43d92cf6ddb6b9464a153da50 Log: JENKINS-32792 - Added check for "sha256:" prefix in image ID
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Oleg Nenashev
            Path:
            src/main/java/org/jenkinsci/plugins/docker/commons/fingerprint/DockerFingerprints.java
            http://jenkins-ci.org/commit/docker-commons-plugin/e53ebf8ff63509566ff242c960c5bbd8655618b3
            Log:
            Merge pull request #46 from theartoflogic/master

            [FIXED JENKINS-32792] Added check for "sha256:" prefix in image ID

            Compare: https://github.com/jenkinsci/docker-commons-plugin/compare/9d994faeff31...e53ebf8ff635

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: src/main/java/org/jenkinsci/plugins/docker/commons/fingerprint/DockerFingerprints.java http://jenkins-ci.org/commit/docker-commons-plugin/e53ebf8ff63509566ff242c960c5bbd8655618b3 Log: Merge pull request #46 from theartoflogic/master [FIXED JENKINS-32792] Added check for "sha256:" prefix in image ID Compare: https://github.com/jenkinsci/docker-commons-plugin/compare/9d994faeff31...e53ebf8ff635
            scm_issue_link SCM/JIRA link daemon made changes -
            Status Open [ 1 ] Resolved [ 5 ]
            Resolution Fixed [ 1 ]
            Hide
            taylorp36 Taylor Patton added a comment -

            Can bypass the failure if I uncheck "Create fingerprints" in Docker Build&Publish Advanced section

            Show
            taylorp36 Taylor Patton added a comment - Can bypass the failure if I uncheck "Create fingerprints" in Docker Build&Publish Advanced section
            Hide
            martinachtman Martin Achtman added a comment -

            Still same problem here with docker-commons: 1.3.1 + docker-build-publish: 1.2 plugin, when used with docker 1.10 fingerprint workarround is needed.

            Show
            martinachtman Martin Achtman added a comment - Still same problem here with docker-commons: 1.3.1 + docker-build-publish: 1.2 plugin, when used with docker 1.10 fingerprint workarround is needed.
            clausfod clausfod made changes -
            Resolution Fixed [ 1 ]
            Status Resolved [ 5 ] Reopened [ 4 ]
            Hide
            clausfod clausfod added a comment -

            Still a problem with docker-commons 1.3.1 and docker-build-publish 1.2

            Show
            clausfod clausfod added a comment - Still a problem with docker-commons 1.3.1 and docker-build-publish 1.2
            csanchez Carlos Sanchez made changes -
            Link This issue is duplicated by JENKINS-33278 [ JENKINS-33278 ]
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Carlos Sanchez
            Path:
            pom.xml
            src/main/java/com/cloudbees/dockerpublish/DockerBuilder.java
            http://jenkins-ci.org/commit/docker-build-publish-plugin/2b42838aca2f0d440d6dada06636cfcacfc0a443
            Log:
            JENKINS-32792 Fix error whith fingerprints when parent image is not set

            Expecting 64-char full image ID, but got

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Carlos Sanchez Path: pom.xml src/main/java/com/cloudbees/dockerpublish/DockerBuilder.java http://jenkins-ci.org/commit/docker-build-publish-plugin/2b42838aca2f0d440d6dada06636cfcacfc0a443 Log: JENKINS-32792 Fix error whith fingerprints when parent image is not set Expecting 64-char full image ID, but got
            Hide
            csanchez Carlos Sanchez added a comment -

            Fixed in 1.2.1

            Show
            csanchez Carlos Sanchez added a comment - Fixed in 1.2.1
            csanchez Carlos Sanchez made changes -
            Status Reopened [ 4 ] Closed [ 6 ]
            Assignee Carlos Sanchez [ csanchez ]
            Resolution Fixed [ 1 ]
            rtyler R. Tyler Croy made changes -
            Workflow JNJira [ 168457 ] JNJira + In-Review [ 209677 ]

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: