Details
-
Type:
Bug
-
Status: Resolved (View Workflow)
-
Priority:
Minor
-
Resolution: Fixed
-
Component/s: docker-workflow-plugin
-
Labels:None
-
Environment:Debian Jessie x64
Docker Pipeline 1.11
Jenkins ver. 2.46.3
Docker version 17.05.0-ce, build 89658be
-
Similar Issues:
-
Released As:docker-workflow 1.19
Description
When using named stages in a multistage build as in the example below, the Jenkins pipeline will fail with the following message right after the build has finished.
<SNIP> Successfully built b59ee5bc6b07 Successfully tagged bytesheep/odr-dabmux:latest [Pipeline] dockerFingerprintFrom [Pipeline] } [Pipeline] // stage [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline java.io.IOException: Cannot retrieve .Id from 'docker inspectalpine:3.6 AS builder' at org.jenkinsci.plugins.docker.workflow.client.DockerClient.inspectRequiredField(DockerClient.java:193) at org.jenkinsci.plugins.docker.workflow.FromFingerprintStep$Execution.run(FromFingerprintStep.java:119) at org.jenkinsci.plugins.docker.workflow.FromFingerprintStep$Execution.run(FromFingerprintStep.java:75) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47) at hudson.security.ACL.impersonate(ACL.java:260) 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:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:748) Finished: FAILURE
Dockerfile
#
# Build environment
#
FROM alpine:3.6 AS builder
<SNIP>
#
# Create final container
#
FROM alpine:3.6
<SNIP>
# Copy artifacts from builder
COPY --from=builder /usr/local .
There is a workaround to this issue by removing the names and using the build numbers instead. example:
FROM alpine:3.6 <SNIP> FROM alpine:3.6 COPY --from=0 /usr/local .
Looking at the related source at #100, it seems the code determains the image name looking at FROM and taking everything until EOL. Which would include 'AS buildname'.
At a glance it also looks like the code will take the first stage for fingerprinting instead of the final stage (which is the resulting image).
Attachments
Issue Links
- is duplicated by
-
JENKINS-44789 docker 17.05 multistage Dockerfile breaks dockerFingerprintFrom
-
- Resolved
-
Activity
Field | Original Value | New Value |
---|---|---|
Link |
This issue relates to |
Assignee | Eric Smalling [ esmalling ] |
Status | Open [ 1 ] | In Progress [ 3 ] |
Status | In Progress [ 3 ] | In Review [ 10005 ] |
Resolution | Fixed [ 1 ] | |
Status | In Review [ 10005 ] | Resolved [ 5 ] |
Status | Resolved [ 5 ] | Closed [ 6 ] |
Resolution | Fixed [ 1 ] | |
Status | Closed [ 6 ] | Reopened [ 4 ] |
Released As | docker-workflow 1.19 | |
Resolution | Fixed [ 1 ] | |
Status | Reopened [ 4 ] | Resolved [ 5 ] |
Link |
This issue relates to |
Link |
This issue is duplicated by |
One clue here that might be useful here: https://github.com/moby/moby/pull/33185/files
There is a "–target" option to docker build that can help. But if you target only the build part in your example
then, the child images (the other FROM) will be ignored.
The user need for the docker workflow plugin to express instructions to build in the docker-provided build environment are the same as this multi-stage build.
The plugin does not seems currently useful with multi stage: moving to a simple sh 'docker build -t image ./' should be enough there, outside the need for fingerprinting maybe ?
=> The big concern is "how to make jenkins access the intermediate container, like for publishing tests units or reports" ?
For today, I'm trying to parse the docker build output, and the use docker cp to get the files in the workspace, which is portable in term of UID, and less painful.