-
Bug
-
Resolution: Duplicate
-
Minor
-
None
If you use dir() inside a docker.inside block - it will not work as expected.
Take the following script, which works as expected with dir():
node("docker") { deleteDir() stage 'build blueocean' dir('blueocean') { git url: 'https://github.com/jenkinsci/blueocean-plugin.git' sh 'ls -lah' } stage 'prepare acceptance test harness' dir("acceptance") { git url: 'https://github.com/cloudbees/blueocean-acceptance-test.git', branch: 'master' sh 'ls -lah' } }
The contents of ear dir are correct. However, tweaking it slightly:
node("docker") { deleteDir() docker.image('cloudbees/java-build-tools').inside { stage 'build blueocean' dir('blueocean') { git url: 'https://github.com/jenkinsci/blueocean-plugin.git' sh 'ls -lah' } stage 'prepare acceptance test harness' dir("acceptance") { git url: 'https://github.com/cloudbees/blueocean-acceptance-test.git', branch: 'master' sh 'ls -lah' } } }
And the listings show a level above the dir, even though each dir is created, ie:
+ ls -lah total 16K drwxrwxr-x 4 jenkins jenkins 4.0K Jun 10 05:24 . drwxr-xr-x 4 root root 4.0K Jun 10 05:24 .. drwxrwxr-x 13 jenkins jenkins 4.0K Jun 10 05:24 blueocean drwxrwxr-x 3 jenkins jenkins 4.0K Jun 10 05:24 blueocean@tmp .. + ls -lah total 24K drwxrwxr-x 6 jenkins jenkins 4.0K Jun 10 05:24 . drwxr-xr-x 4 root root 4.0K Jun 10 05:24 .. drwxrwxr-x 4 jenkins jenkins 4.0K Jun 10 05:24 acceptance drwxrwxr-x 3 jenkins jenkins 4.0K Jun 10 05:24 acceptance@tmp drwxrwxr-x 13 jenkins jenkins 4.0K Jun 10 05:24 blueocean drwxrwxr-x 2 jenkins jenkins 4.0K Jun 10 05:24 blueocean@tmp
Just a little bit maddening as I thought I was going insane.
dir outside of docker block works just fine, as expected.
- depends on
-
JENKINS-33510 dir('foo') inside "docker.image().inside{}" does not affect CWD of launched processes
- Resolved