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

Pipeline customWorkspace not obeyed in docker agent when reuseNode is true

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None

      When you use the 'customWorkspace' declarative Pipeline option in a docker agent, it is working correctly. (see attached Jenkinsfile.pass log.pass )

      The problem I'm encountering is if you also add the 'reuseNode true' option for that docker agent, then the 'customWorkspace' option is no longer obeyed. (see Jenkinsfile.fail log.fail )

      What happens is the stage runs in the same workspace as the previous stage (/Users/rkivisto/.jenkins/workspace/pipeline) which was not even run on the same agent (the first stage was run on the Master, the second stage is running in a container)

      You can see the error from the "sh 'pwd'" in the second stage, I would have expected both of these to be in '/Users/rkivisto/.jenkins/test', since the first stage was not run in the same agent as the second stage:

      diff log.pass log.fail
      ...
      < /Users/rkivisto/.jenkins/test

      > /Users/rkivisto/.jenkins/workspace/pipeline

        1. Jenkinsfile.fail
          0.4 kB
        2. Jenkinsfile.pass
          0.4 kB
        3. log.fail
          2 kB
        4. log.pass
          2 kB

            abayer Andrew Bayer
            rkivisto Ray Kivisto
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: