-
Type:
Bug
-
Resolution: Won't Fix
-
Priority:
Critical
-
Component/s: pipeline-model-definition-plugin
-
Environment:Jenkins 2.45, pipeline-mode-definition-plugin 1.0
When running a declarative pipeline where one step is executed inside a docker image and another step doesn't the commands are executed in different directories.
For example the output of the attached Jenkinsfile is:
[Pipeline] stage
[Pipeline] { (build)
[Pipeline] node
Running on master in /var/lib/jenkins/workspace/enkins-pipeline-test_master-P4NWY5PAMN3ERY6WPQW6JSZQFPG7ON34FEGANUPSGPVVMSMYGNNA@2
[Pipeline] {
[Pipeline] sh
[enkins-pipeline-test_master-P4NWY5PAMN3ERY6WPQW6JSZQFPG7ON34FEGANUPSGPVVMSMYGNNA@2] Running shell script
+ docker inspect -f . openjdk:8u111-jdk
.
[Pipeline] withDockerContainer
$ docker run -t -d -u 108:113 -w /var/lib/jenkins/workspace/enkins-pipeline-test_master-P4NWY5PAMN3ERY6WPQW6JSZQFPG7ON34FEGANUPSGPVVMSMYGNNA@2 -v /var/lib/jenkins/workspace/enkins-pipeline-test_master-P4NWY5PAMN3ERY6WPQW6JSZQFPG7ON34FEGANUPSGPVVMSMYGNNA@2:/var/lib/jenkins/workspace/enkins-pipeline-test_master-P4NWY5PAMN3ERY6WPQW6JSZQFPG7ON34FEGANUPSGPVVMSMYGNNA@2:rw -v /var/lib/jenkins/workspace/enkins-pipeline-test_master-P4NWY5PAMN3ERY6WPQW6JSZQFPG7ON34FEGANUPSGPVVMSMYGNNA@2@tmp:/var/lib/jenkins/workspace/enkins-pipeline-test_master-P4NWY5PAMN3ERY6WPQW6JSZQFPG7ON34FEGANUPSGPVVMSMYGNNA@2@tmp:rw -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** --entrypoint cat openjdk:8u111-jdk
[Pipeline]Unknown macro: {[Pipeline] checkoutCloning the remote Git repository....removed....[Pipeline] sh[enkins-pipeline-test_master-P4NWY5PAMN3ERY6WPQW6JSZQFPG7ON34FEGANUPSGPVVMSMYGNNA@2] Running shell script+ pwd/var/lib/jenkins/workspace/enkins-pipeline-test_master-P4NWY5PAMN3ERY6WPQW6JSZQFPG7ON34FEGANUPSGPVVMSMYGNNA@2[Pipeline] }$ docker stop --time=1 b377c0539defa63fed13c99c261b700eea94e6f970e5f25b558f658e46e27b09
$ docker rm -f b377c0539defa63fed13c99c261b700eea94e6f970e5f25b558f658e46e27b09
[Pipeline] // withDockerContainer
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (image)
[Pipeline] sh
[enkins-pipeline-test_master-P4NWY5PAMN3ERY6WPQW6JSZQFPG7ON34FEGANUPSGPVVMSMYGNNA] Running shell script
+ pwd
/var/lib/jenkins/workspace/enkins-pipeline-test_master-P4NWY5PAMN3ERY6WPQW6JSZQFPG7ON34FEGANUPSGPVVMSMYGNNA
[Pipeline] script
[Pipeline]Unknown macro: {[Pipeline] sh[enkins-pipeline-test_master-P4NWY5PAMN3ERY6WPQW6JSZQFPG7ON34FEGANUPSGPVVMSMYGNNA] Running shell script+ pwd/var/lib/jenkins/workspace/enkins-pipeline-test_master-P4NWY5PAMN3ERY6WPQW6JSZQFPG7ON34FEGANUPSGPVVMSMYGNNA[Pipeline] }[Pipeline] // script
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
This creates issues when for example gradle should be run inside a docker image (in order to control the environment) but one build step generates a new docker image (so it should be run directly on the Jenkins slave host).