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

dockerfile: ARG in FROM breaks docker inspect

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • docker-workflow 1.17, pipeline-model-definition 1.3.4.1, Jenkins 2.165

      Please note that there is already an issue with a very similar name regarding the docker-workflow plugin here: https://issues.jenkins-ci.org/browse/JENKINS-46105

      The issue actually has been fixed already at the docker-workflow plugin, but the pipeline-model-definition-plugin fails to take advantage of that.

      The issue in a nutshell:

      I have this Dockerfile (excerpt):

      ARG VERSION=latest
      FROM repo-vp.development.ems:5000/emsys-adoptopenjdk11:${VERSION}
      

       

      This is part of my declarative Jenkinsfile:

              stage('Build') {
                agent { 
                  dockerfile {
                    filename 'Dockerfile'
                    additionalBuildArgs "--build-arg VERSION=jdk-11.0.2.9"
                    reuseNode true
                  }
                }
                steps {
                  (...)
                }
              }
      

       

      This results in a failed build with the following error log:

      java.io.IOException: Cannot retrieve .Id from 'docker inspect repo-vp.development.ems:5000/emsys-adoptopenjdk11:${VERSION}'
      	at org.jenkinsci.plugins.docker.workflow.client.DockerClient.inspectRequiredField(DockerClient.java:220)
      	at org.jenkinsci.plugins.docker.workflow.FromFingerprintStep$Execution.run(FromFingerprintStep.java:133)
      	at org.jenkinsci.plugins.docker.workflow.FromFingerprintStep$Execution.run(FromFingerprintStep.java:85)
      	at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
      	at hudson.security.ACL.impersonate(ACL.java:290)
      	at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at java.lang.Thread.run(Thread.java:748)
      Finished: FAILURE
      

      This has already been fixed by the docker-workflow plugin (see JENKINS-46105), but "pipeline-model-definition" has yet to take advantage of that.

      Please see this line in your plugin: https://github.com/jenkinsci/pipeline-model-definition-plugin/blob/7502d14aa4db891302abf48a2c7de7c9ced97f95/pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/DockerPipelineFromDockerfileScript.groovy#L83

      As you can see, you don't pass the new parameter "buildArgs" to the instance of `dockerFingerprintFrom`. See the setter here: https://github.com/jenkinsci/docker-workflow-plugin/blob/dbeb7cf23961fdb5cbc495e8067bd42c56dcdfc5/src/main/java/org/jenkinsci/plugins/docker/workflow/FromFingerprintStep.java#L81

      If you just pass the build-args to this step, the issue should be resolved.

       

          [JENKINS-56294] dockerfile: ARG in FROM breaks docker inspect

          Christian Ciach created issue -
          Christian Ciach made changes -
          Description Original: Please note that there is already an issue with a very similar name regarding the docker-workflow plugin here: https://issues.jenkins-ci.org/browse/JENKINS-46105

          The issue actually has been fixed already at the docker-workflow plugin, but the pipeline-model-definition-plugin fails to take advantage of that.

          The issue in a nutshell:

          I have this Dockerfile (excerpt):

           
          {code:java}
          ARG VERSION=latest
          FROM repo-vp.development.ems:5000/emsys-adoptopenjdk11:${VERSION}
          {code}
          This is part of my declarative Jenkinsfile:

           

           
          {code:java}
                  stage('Build') {
                    agent {
                      dockerfile {
                        filename 'Dockerfile'
                        additionalBuildArgs "--build-arg VERSION=jdk-11.0.2.9"
                        reuseNode true
                      }
                    }
                    steps {
                      (...)
                    }
                  }
          {code}
           

          This results in a failed build with the following error log:
          {code:java}
          java.io.IOException: Cannot retrieve .Id from 'docker inspect repo-vp.development.ems:5000/emsys-adoptopenjdk11:${VERSION}'
          at org.jenkinsci.plugins.docker.workflow.client.DockerClient.inspectRequiredField(DockerClient.java:220)
          at org.jenkinsci.plugins.docker.workflow.FromFingerprintStep$Execution.run(FromFingerprintStep.java:133)
          at org.jenkinsci.plugins.docker.workflow.FromFingerprintStep$Execution.run(FromFingerprintStep.java:85)
          at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
          at hudson.security.ACL.impersonate(ACL.java:290)
          at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
          at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
          at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
          at java.lang.Thread.run(Thread.java:748)
          Finished: FAILURE
          {code}
          This has already been fixed by the docker-workflow plugin (see JENKINS-46105), but "pipeline-model-definition" has yet to take advantage of that.

          Please see this line in your plugin: [https://github.com/jenkinsci/pipeline-model-definition-plugin/blob/7502d14aa4db891302abf48a2c7de7c9ced97f95/pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/DockerPipelineFromDockerfileScript.groovy#L83]

          As you can see, you don't pass the new parameter "buildArgs" to the instance of `dockerFingerprintFrom`. See the setter here: [https://github.com/jenkinsci/docker-workflow-plugin/blob/dbeb7cf23961fdb5cbc495e8067bd42c56dcdfc5/src/main/java/org/jenkinsci/plugins/docker/workflow/FromFingerprintStep.java#L81]

          If you just pass the build-args to this step, the issue should be resolved.

           
          New: Please note that there is already an issue with a very similar name regarding the docker-workflow plugin here: https://issues.jenkins-ci.org/browse/JENKINS-46105

          The issue actually has been fixed already at the docker-workflow plugin, but the pipeline-model-definition-plugin fails to take advantage of that.

          The issue in a nutshell:

          I have this Dockerfile (excerpt):

           
          {code:java}
          ARG VERSION=latest
          FROM repo-vp.development.ems:5000/emsys-adoptopenjdk11:${VERSION}
          {code}
           

          This is part of my declarative Jenkinsfile:
          {code:java}
                  stage('Build') {
                    agent {
                      dockerfile {
                        filename 'Dockerfile'
                        additionalBuildArgs "--build-arg VERSION=jdk-11.0.2.9"
                        reuseNode true
                      }
                    }
                    steps {
                      (...)
                    }
                  }
          {code}
           

          This results in a failed build with the following error log:
          {code:java}
          java.io.IOException: Cannot retrieve .Id from 'docker inspect repo-vp.development.ems:5000/emsys-adoptopenjdk11:${VERSION}'
          at org.jenkinsci.plugins.docker.workflow.client.DockerClient.inspectRequiredField(DockerClient.java:220)
          at org.jenkinsci.plugins.docker.workflow.FromFingerprintStep$Execution.run(FromFingerprintStep.java:133)
          at org.jenkinsci.plugins.docker.workflow.FromFingerprintStep$Execution.run(FromFingerprintStep.java:85)
          at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
          at hudson.security.ACL.impersonate(ACL.java:290)
          at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
          at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
          at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
          at java.lang.Thread.run(Thread.java:748)
          Finished: FAILURE
          {code}
          This has already been fixed by the docker-workflow plugin (see JENKINS-46105), but "pipeline-model-definition" has yet to take advantage of that.

          Please see this line in your plugin: [https://github.com/jenkinsci/pipeline-model-definition-plugin/blob/7502d14aa4db891302abf48a2c7de7c9ced97f95/pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/DockerPipelineFromDockerfileScript.groovy#L83]

          As you can see, you don't pass the new parameter "buildArgs" to the instance of `dockerFingerprintFrom`. See the setter here: [https://github.com/jenkinsci/docker-workflow-plugin/blob/dbeb7cf23961fdb5cbc495e8067bd42c56dcdfc5/src/main/java/org/jenkinsci/plugins/docker/workflow/FromFingerprintStep.java#L81]

          If you just pass the build-args to this step, the issue should be resolved.

           
          Christian Ciach made changes -
          Description Original: Please note that there is already an issue with a very similar name regarding the docker-workflow plugin here: https://issues.jenkins-ci.org/browse/JENKINS-46105

          The issue actually has been fixed already at the docker-workflow plugin, but the pipeline-model-definition-plugin fails to take advantage of that.

          The issue in a nutshell:

          I have this Dockerfile (excerpt):

           
          {code:java}
          ARG VERSION=latest
          FROM repo-vp.development.ems:5000/emsys-adoptopenjdk11:${VERSION}
          {code}
           

          This is part of my declarative Jenkinsfile:
          {code:java}
                  stage('Build') {
                    agent {
                      dockerfile {
                        filename 'Dockerfile'
                        additionalBuildArgs "--build-arg VERSION=jdk-11.0.2.9"
                        reuseNode true
                      }
                    }
                    steps {
                      (...)
                    }
                  }
          {code}
           

          This results in a failed build with the following error log:
          {code:java}
          java.io.IOException: Cannot retrieve .Id from 'docker inspect repo-vp.development.ems:5000/emsys-adoptopenjdk11:${VERSION}'
          at org.jenkinsci.plugins.docker.workflow.client.DockerClient.inspectRequiredField(DockerClient.java:220)
          at org.jenkinsci.plugins.docker.workflow.FromFingerprintStep$Execution.run(FromFingerprintStep.java:133)
          at org.jenkinsci.plugins.docker.workflow.FromFingerprintStep$Execution.run(FromFingerprintStep.java:85)
          at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
          at hudson.security.ACL.impersonate(ACL.java:290)
          at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
          at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
          at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
          at java.lang.Thread.run(Thread.java:748)
          Finished: FAILURE
          {code}
          This has already been fixed by the docker-workflow plugin (see JENKINS-46105), but "pipeline-model-definition" has yet to take advantage of that.

          Please see this line in your plugin: [https://github.com/jenkinsci/pipeline-model-definition-plugin/blob/7502d14aa4db891302abf48a2c7de7c9ced97f95/pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/DockerPipelineFromDockerfileScript.groovy#L83]

          As you can see, you don't pass the new parameter "buildArgs" to the instance of `dockerFingerprintFrom`. See the setter here: [https://github.com/jenkinsci/docker-workflow-plugin/blob/dbeb7cf23961fdb5cbc495e8067bd42c56dcdfc5/src/main/java/org/jenkinsci/plugins/docker/workflow/FromFingerprintStep.java#L81]

          If you just pass the build-args to this step, the issue should be resolved.

           
          New: Please note that there is already an issue with a very similar name regarding the docker-workflow plugin here: https://issues.jenkins-ci.org/browse/JENKINS-46105

          The issue actually has been fixed already at the docker-workflow plugin, but the pipeline-model-definition-plugin fails to take advantage of that.

          The issue in a nutshell:

          I have this Dockerfile (excerpt):
          {code:java}
          ARG VERSION=latest
          FROM repo-vp.development.ems:5000/emsys-adoptopenjdk11:${VERSION}
          {code}
           

          This is part of my declarative Jenkinsfile:
          {code:java}
                  stage('Build') {
                    agent {
                      dockerfile {
                        filename 'Dockerfile'
                        additionalBuildArgs "--build-arg VERSION=jdk-11.0.2.9"
                        reuseNode true
                      }
                    }
                    steps {
                      (...)
                    }
                  }
          {code}
           

          This results in a failed build with the following error log:
          {code:java}
          java.io.IOException: Cannot retrieve .Id from 'docker inspect repo-vp.development.ems:5000/emsys-adoptopenjdk11:${VERSION}'
          at org.jenkinsci.plugins.docker.workflow.client.DockerClient.inspectRequiredField(DockerClient.java:220)
          at org.jenkinsci.plugins.docker.workflow.FromFingerprintStep$Execution.run(FromFingerprintStep.java:133)
          at org.jenkinsci.plugins.docker.workflow.FromFingerprintStep$Execution.run(FromFingerprintStep.java:85)
          at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
          at hudson.security.ACL.impersonate(ACL.java:290)
          at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
          at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
          at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
          at java.lang.Thread.run(Thread.java:748)
          Finished: FAILURE
          {code}
          This has already been fixed by the docker-workflow plugin (see JENKINS-46105), but "pipeline-model-definition" has yet to take advantage of that.

          Please see this line in your plugin: [https://github.com/jenkinsci/pipeline-model-definition-plugin/blob/7502d14aa4db891302abf48a2c7de7c9ced97f95/pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/DockerPipelineFromDockerfileScript.groovy#L83]

          As you can see, you don't pass the new parameter "buildArgs" to the instance of `dockerFingerprintFrom`. See the setter here: [https://github.com/jenkinsci/docker-workflow-plugin/blob/dbeb7cf23961fdb5cbc495e8067bd42c56dcdfc5/src/main/java/org/jenkinsci/plugins/docker/workflow/FromFingerprintStep.java#L81]

          If you just pass the build-args to this step, the issue should be resolved.

           

          Dwight Guth added a comment -

          This has been fixed in my pull request: https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/311

          It would be nice to see some action on this PR so I don't have to keep relying on a manually-built HPI file for this plugin.

          Dwight Guth added a comment - This has been fixed in my pull request: https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/311 It would be nice to see some action on this PR so I don't have to keep relying on a manually-built HPI file for this plugin.
          Andrew Bayer made changes -
          Assignee Original: Andrew Bayer [ abayer ]

            Unassigned Unassigned
            christianciach Christian Ciach
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: