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

Mercurial plugin does not work inside container with Docker Workflow plugin

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Incomplete
    • Icon: Blocker Blocker
    • docker-workflow-plugin
    • Jenkins 1.609.1

      Plugins:
      workflow 1.8
      mercurial 1.54
      docker-workflow 1.0

      docker 1.6.2
      jenkins itself is running in a docker container; access to docker daemon is through shared host unix socket

      The build fails with an AbortException when attempting to do a mercurial checkout inside a container when using the Docker workflow plugin:

      Workflow:

      stage 'Build'
      
      node {
          docker.image('gregsymons/sbt-build').inside {
            checkout([$class: 'MercurialSCM',
                            credentialsId: '69d57484-a048-4ab2-88b1-7483b800bd20', 
                            source:   'https://host.example.com/path/to/repo'])
          }
      }
      

      Build Output:

      Started by user Greg Symons
      Running: Build
      Entering stage Build
      Proceeding
      Running: Allocate node : Start
      Running on master in /var/jenkins_home/workspace/mdm-build-mainline
      Running: Allocate node : Body : Start
      Running: Shell Script
      [mdm-build-mainline] Running shell script
      + docker inspect -f . docker-registry.example.com/infrastructure/sbt-build
      .
      Running: Run build steps inside a Docker container : Start
      $ docker run -t -d -u 500:1000 -w /var/jenkins_home/workspace/mdm-build-mainline -v /var/jenkins_home/workspace/mdm-build-mainline:/var/jenkins_home/workspace/mdm-build-mainline:rw -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** docker-registry.example.com/infrastructure/sbt-build cat
      Running: Run build steps inside a Docker container : Body : Start
      Running: General SCM
      [mdm-build-mainline] $ docker exec 244202c1aa1ad52fe2af97960dc2bd80c8209e74c87f2e991723ed418a40db39 env BUILD_DISPLAY_NAME=#14 BUILD_ID=14 BUILD_NUMBER=14 BUILD_TAG=jenkins-mdm-build-mainline-14 BUILD_URL=https://ci.example.com/job/mdm-build-mainline/14/ CLASSPATH= HGPLAIN=true HUDSON_HOME=/var/jenkins_home HUDSON_SERVER_COOKIE=13cf4891a426050f HUDSON_URL=https://ci.example.com/ JENKINS_SERVER_COOKIE=13cf4891a426050f JENKINS_URL=https://ci.example.com/ JOB_NAME=mdm-build-mainline JOB_URL=https://ci.example.com/job/mdm-build-mainline/ hg --config auth.jenkins.prefix=* --config ******** --config ******** --config "auth.jenkins.schemes=http https" showconfig paths.default
      ERROR: Failed to run docker exec 244202c1aa1ad52fe2af97960dc2bd80c8209e74c87f2e991723ed418a40db39 env BUILD_DISPLAY_NAME=#14 BUILD_ID=14 BUILD_NUMBER=14 BUILD_TAG=jenkins-mdm-build-mainline-14 BUILD_URL=https://ci.example.com/job/mdm-build-mainline/14/ CLASSPATH= HGPLAIN=true HUDSON_HOME=/var/jenkins_home HUDSON_SERVER_COOKIE=13cf4891a426050f HUDSON_URL=https://ci.example.com/ JENKINS_SERVER_COOKIE=13cf4891a426050f JENKINS_URL=https://ci.example.com/ JOB_NAME=mdm-build-mainline JOB_URL=https://ci.example.com/job/mdm-build-mainline/ hg --config auth.jenkins.prefix=* --config auth.jenkins.username=****** --config auth.jenkins.password=****** --config "auth.jenkins.schemes=http https" showconfig paths.default
      ERROR: Failed to determine whether workspace can be reused
      hudson.AbortException
      	at hudson.plugins.mercurial.HgExe.popen(HgExe.java:404)
      	at hudson.plugins.mercurial.HgExe.config(HgExe.java:388)
      	at hudson.plugins.mercurial.MercurialSCM.canReuseWorkspace(MercurialSCM.java:588)
      	at hudson.plugins.mercurial.MercurialSCM.checkout(MercurialSCM.java:540)
      	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:106)
      	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:80)
      	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:70)
      	at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousStepExecution.start(AbstractSynchronousStepExecution.java:34)
      	at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:136)
      	at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:98)
      	at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:45)
      	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
      	at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:15)
      	at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:69)
      	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:106)
      	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:79)
      	at sun.reflect.GeneratedMethodAccessor122.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
      	at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.dispatch(CollectionLiteralBlock.java:55)
      	at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.item(CollectionLiteralBlock.java:45)
      	at sun.reflect.GeneratedMethodAccessor292.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
      	at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
      	at com.cloudbees.groovy.cps.Next.step(Next.java:58)
      	at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:145)
      	at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:164)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:271)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$000(CpsThreadGroup.java:71)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:180)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:178)
      	at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:47)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112)
      	at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
      	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:745)
      Running: Run build steps inside a Docker container : Body : End
      $ docker stop 244202c1aa1ad52fe2af97960dc2bd80c8209e74c87f2e991723ed418a40db39
      $ docker rm -f 244202c1aa1ad52fe2af97960dc2bd80c8209e74c87f2e991723ed418a40db39
      Running: Run build steps inside a Docker container : End
      Running: Allocate node : Body : End
      Running: Allocate node : End
      Running: End of Workflow
      ERROR: Failed to determine whether workspace can be reused
      Finished: FAILURE
      

            jglick Jesse Glick
            gsymons Greg Symons
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: