Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix multifrom Dockerfile parsing #162

Closed
wants to merge 1 commit into from

Conversation

bozaro
Copy link

@bozaro bozaro commented Feb 1, 2019

Fix crash on Dockerfile with FROM <image>[@<digest>] AS <name>:

java.io.IOException: Cannot retrieve .Id from 'docker inspect node:current-alpine AS release'
	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 

@Minipada
Copy link

Can a maintainer check this?

@jonesbusy
Copy link

Hello, yes would be nice if someone would take a look :)

Thanks!

@0181532686cf4a31163be0bf3e6bb6732bf

anyone? :)

@jvtrigueros
Copy link

Two JIRA issues have been filed for this:

Please also vote on these for visibility. I don't understand what the triage process is for this project but that's the very least we can do :)

@jonesbusy
Copy link

Voted!

@Minipada
Copy link

Minipada commented May 1, 2019

i voted and commented on all 3 (yes, there's a third one JENKINS-31507) with a link to this PR already

@empyrean987
Copy link

Anyone Looking at this PR. I'm running into this issue also?

@Minipada
Copy link

Minipada commented May 3, 2019

I guess we all commented and voted because of this @empyrean987

@erNail
Copy link

erNail commented May 3, 2019

Also running into this issue.

@Danulb
Copy link

Danulb commented May 3, 2019

Please check this. I have also the issue.

@knlambert
Copy link

Also running into the issue.

@derekwilliamscrosswinds
Copy link

Also running into this issue.

1 similar comment
@walkermundo
Copy link

Also running into this issue.

@cosi1
Copy link

cosi1 commented May 14, 2019

Piggybacking on this thread:

This issue also happens when nested variables are used after FROM statement. Example:

ARG REPOSITORY=my_repository/
ARG NAME=${REPOSITORY}base
ARG VERSION=latest
FROM ${NAME}:${VERSION}
...

The above will crash with an unresolved base image name (${REPOSITORY}base instead of my_repository/base):

java.io.IOException: Cannot retrieve .Id from 'docker inspect ${REPOSITORY}base:latest'

@Minipada
Copy link

Yes, the reason is that the plugin saves the container image as everything after character 5. Please upvote the thread on the links

@bozaro
Copy link
Author

bozaro commented May 29, 2019

@dwnusbaum, please view this PR and comment something...

@praves77
Copy link

Also running into this issue.

@monsterxx03
Copy link

Even you didn't use multi stage build, just enter more than 1 space after FROM will see same error, take long time to debug.....

@jessecooper
Copy link

This would be really nice to have about now.

@VintageMo
Copy link

This breaks on the vanilla dockerfile generated by Visual Studio. This should've been fixed and released long ago.
To repro, create a .net core web service, add docker support, then try that generated dockerfile.

Is there an ETA for the release of this?

@naphthalene
Copy link

naphthalene commented Jul 16, 2019

@dwnusbaum This needs to get shipped - multicontainer builds cannot be thrown out the window because of this and while a workaround exists, it has to be coded for specifically in each job. If images later become multi-stage in a job they will start failing.

@Rachitmehrotra
Copy link

Please look into this, still we are getting same issue,
"java.io.IOException: Cannot retrieve .Id from 'docker inspect base'".
Please update we are waiting for this .

@Jim-Bar
Copy link

Jim-Bar commented Jul 22, 2019

Same error here: java.io.IOException: Cannot retrieve .Id from 'docker inspect baseimage AS jenkinsimage'.

The only workaround I can think of right now is stopping using this plugin and manually running Docker commands with sh "docker build/run ...".

@dignajar
Copy link

I face the same error here but the problem was the spaces between the FROM and the image name.

FROM (2 spaces) python:3.6

Thanks @monsterxx03

@jglick
Copy link
Member

jglick commented Jul 22, 2019

I do not recommend trying to fix this sort of thing per se. See #149 (comment).

@bjoernhaeuser
Copy link
Contributor

I went ahead and created a PR to remove the line: #180

@dwnusbaum
Copy link
Member

dwnusbaum commented Aug 2, 2019

The code modified in this PR was deprecated by #180 and will no longer be called in normal usage in the next release (1.19), so I am closing it. Please reopen the PR if I missed something and this code still matters for use cases outside of FromFingerprintStep and RunFingerprintStep. Thanks!

@dwnusbaum dwnusbaum closed this Aug 2, 2019
grugnog added a commit to drydockcloud/drupal-acquia that referenced this pull request Aug 3, 2019
grugnog added a commit to drydockcloud/drupal-pantheon that referenced this pull request Aug 3, 2019
@Jim-Bar
Copy link

Jim-Bar commented Aug 14, 2019

We're still hitting this issue with docker-workflow 1.19, docker plugin 1.1.7 and Jenkins 2.176.2:

java.io.IOException: Cannot retrieve .Id from 'docker inspect base'
at org.jenkinsci.plugins.docker.workflow.client.DockerClient.inspectRequiredField(DockerClient.java:220)
at org.jenkinsci.plugins.docker.workflow.FromFingerprintStep$Execution.run(FromFingerprintStep.java:118)
at org.jenkinsci.plugins.docker.workflow.FromFingerprintStep$Execution.run(FromFingerprintStep.java:88)
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)

Dockerfile:

FROM alpine:latest AS base
(...)

FROM base
(...)

I can see that the deprecated code is still called for some reason. Thoughts?

@bjoernhaeuser
Copy link
Contributor

Whats in your Jenkinsfile?

@Jim-Bar
Copy link

Jim-Bar commented Aug 14, 2019

Here it is:

pipeline {
    agent {
        dockerfile {
            // For the entry point, refer to:
            // https://issues.jenkins-ci.org/browse/JENKINS-49385
            args '--entrypoint=""'
        }
    }
    stages {
        stage('Build') {
            steps {
                withCredentials([sshUserPrivateKey(
                    credentialsId: 'our_git_credentials',
                    keyFileVariable: 'KEY_FILE_PATH')]) {
                    sh """
                        GIT_SSH_COMMAND="ssh -i \\"${KEY_FILE_PATH}\\" -o StrictHostKeyChecking=no" ./script.sh
                    """
                }
            }
        }
    }
}

@bjoernhaeuser
Copy link
Contributor

@bjoernhaeuser
Copy link
Contributor

I opened the PR: jenkinsci/pipeline-model-definition-plugin#350

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet