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
- duplicates
-
JENKINS-48319 customWorkspace does not work with docker agent
-
- Open
-