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

WithContainerStep.Decorator fails to call DockerTool.getExecutable on toolName

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      So Image.inside does not work inside withTool if you did not in fact have a docker in your $PATH otherwise.

        Attachments

          Issue Links

            Activity

            Hide
            jglick Jesse Glick added a comment -

            Without the fix for JENKINS-36082 this is a moot point.

            Show
            jglick Jesse Glick added a comment - Without the fix for JENKINS-36082 this is a moot point.
            Hide
            jglick Jesse Glick added a comment -

            To reproduce:

            • docker run --rm -p 8080:8080 -p 50000:50000 -v $(which docker):/usr/bin/docker -v /var/run/docker.sock:/var/run/docker.sock --group-add=$(stat -c %g /var/run/docker.sock) -v JENKINS-37951-JENKINS_HOME:/var/jenkins_home --name jenkins jenkins:2.7.3
            • log in as provided admin user
            • close rest of setup wizard
            • in /configure set root URL to http://jenkins:8080/
            • install docker-workflow, workflow-job, workflow-basic-steps
            • in /configureTools/ add a Docker installation docker-latest using automatic installer to select latest from docker.io; Save
            • /computer/new, name it agent, remote dir /tmp/agent, JNLP launcher, Save, note secret on agent index page
            • docker run --rm -v /var/run/docker.sock:/var/run/docker.sock --group-add=$(stat -c %g /var/run/docker.sock) --name=agent --link=jenkins cloudbees/jnlp-slave-with-java-build-tools -url http://jenkins:8080 <THESECRET> agent
            • create a new Pipeline, name irrelevant
            • define script to be
              node('agent') {
                  docker.withTool('docker-latest') {
                      docker.image('ubuntu').inside {
                          sh 'uname -a'
                      }
                  }
              }
              
            • run build

            You will see the build fail with the attached log file.

            Show
            jglick Jesse Glick added a comment - To reproduce: docker run --rm -p 8080:8080 -p 50000:50000 -v $(which docker):/usr/bin/docker -v /var/run/docker.sock:/var/run/docker.sock --group-add=$(stat -c %g /var/run/docker.sock) -v JENKINS-37951 -JENKINS_HOME:/var/jenkins_home --name jenkins jenkins:2.7.3 log in as provided admin user close rest of setup wizard in /configure set root URL to http:/ /jenkins:8080/ install docker-workflow , workflow-job , workflow-basic-steps in /configureTools/ add a Docker installation docker-latest using automatic installer to select latest from docker.io; Save /computer/new , name it agent , remote dir /tmp/agent , JNLP launcher, Save , note secret on agent index page docker run --rm -v /var/run/docker.sock:/var/run/docker.sock --group-add=$(stat -c %g /var/run/docker.sock) --name=agent --link=jenkins cloudbees/jnlp-slave-with-java-build-tools -url http:/ /jenkins:8080 <THESECRET> agent create a new Pipeline, name irrelevant define script to be node( 'agent' ) { docker.withTool( 'docker-latest' ) { docker.image( 'ubuntu' ).inside { sh 'uname -a' } } } run build You will see the build fail with the attached log file.
            Hide
            jglick Jesse Glick added a comment -

            Actually need to pass -v JENKINS-37951-remotefs:/home/jenkins to the agent launch command, and pick /home/jenkins as the remote FS root. Then I find another bug, which I will fix: the --volumes-from detection incorrectly assumed that volumes had been predeclared (VOLUME in Dockerfile). Useful to add another sh 'uname -a' directly inside node to see this.

            Show
            jglick Jesse Glick added a comment - Actually need to pass -v JENKINS-37951 -remotefs:/home/jenkins to the agent launch command, and pick /home/jenkins as the remote FS root. Then I find another bug, which I will fix: the --volumes-from detection incorrectly assumed that volumes had been predeclared ( VOLUME in Dockerfile ). Useful to add another sh 'uname -a' directly inside node to see this.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            src/main/java/org/jenkinsci/plugins/docker/workflow/WithContainerStep.java
            http://jenkins-ci.org/commit/docker-workflow-plugin/8b745de6fea3d998d6ce062bd5b0a6ae9898b11e
            Log:
            [FIXED JENKINS-37951] Honor withTool from Image.inside.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/org/jenkinsci/plugins/docker/workflow/WithContainerStep.java http://jenkins-ci.org/commit/docker-workflow-plugin/8b745de6fea3d998d6ce062bd5b0a6ae9898b11e Log: [FIXED JENKINS-37951] Honor withTool from Image.inside.

              People

              • Assignee:
                jglick Jesse Glick
                Reporter:
                jglick Jesse Glick
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: