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

"Could not find the history docker layer" when publishing build Info to artifactory

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • artifactory-plugin
    • Amazon Linux 4.9.58-18.55.amzn1.x86_64, Docker version 17.06.2-ce, Jenkins 2.89, Artifactory 5.5.2, Artifactory Plugin 2.13.1

      Description: I followed Jenkins Artifactory Plugin - Setting Up Docker Build Info and got

      Pushing image: mycompany-docker-local.jfrog.io/my-app:2dca83a
      Docker build-info captured on 'Jenkins' agent.
      Successfully pushed docker image: mycompany-docker-local.jfrog.io/my-app:2dca83a
      [Pipeline] publishBuildInfo
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] End of Pipeline
      java.lang.IllegalStateException: Could not find the history docker layer: sha256:f88085956a84ef2f7a1e138ce82e3ac1a6d2c4c629c6d696643649810e202e7f for image: mycompany-docker-local.jfrog.io/my-app:2dca83a in Artifactory.

      The Image push is successful via the reverse proxy. I was able to verify that the reverse proxy is setup correctly on docker by stopping Jenkins and trying to push/pull images to/from the artifactory instance.

       

      My Jenkinsfile:

      node {
        def server = Artifactory.server 'mycompany.jfrog.io'
        def rtDocker = Artifactory.docker credentialsId: 'jfrog-deploy'
        
        def commit_id
        stage ('Preparation') {
          checkout scm
          sh "git rev-parse --short HEAD > .git/commit-id"
          commit_id = readFile('.git/commit-id').trim()
        }
        stage ('build docker image') {
          img = docker.build('my-app')
        }
        stage ('test') {
          docker.image('my-app').inside {
            sh 'cd /app'
            sh 'npm start &'
            sh 'npm test'
          }
        }
        stage('docker build/push') {
          docker.build("mycompany-docker-local.jfrog.io/my-app:${commit_id}")
          def buildInfo = rtDocker.push("mycompany-docker-local.jfrog.io/my-app:${commit_id}", 'my-app')
          server.publishBuildInfo buildInfo
        }
      }

            eyalbe Eyal Ben Moshe
            pradeepvrd Pradeep Varadharajan
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: