Details
-
Bug
-
Status: Resolved (View Workflow)
-
Critical
-
Resolution: Fixed
Description
The "dir('foo')" step inside "docker.image('my-image').inside" creates a directory "foo@tmp" instead of changing the current directory as expected.
In the test below, ">>> SHOULD LS THE foo DIR" is showing an "ls" is the parent dir instead of changing to the "foo" dir and we see a dir "foo@tmp" that have been created.
This problem is specific to "docker.image('my-image').inside", it does not happen with a standard "node".
docker.image('cloudbees/java-build-tools:0.0.7.1').inside { sh 'rm -rf foo*' // RE INIT TEST println '>>> LS THE PARENT DIR' sh 'mkdir -p foo/bar' sh 'ls -al' dir('foo') { println '>>> SHOULD LS THE foo DIR' sh 'ls -al' } }
Started by user admin [Pipeline] Allocate node : Start Running on jenkins-agent.beesshop.org in /home/ubuntu/jenkins-aws-home/workspace/tests/test-change-dir-4 [Pipeline] node { [Pipeline] sh [test-change-dir-4] Running shell script + docker inspect -f . cloudbees/java-build-tools:0.0.7.1 . [Pipeline] Run build steps inside a Docker container : Start $ docker run -t -d -u 1000:1000 -w /home/ubuntu/jenkins-aws-home/workspace/tests/test-change-dir-4 -v /home/ubuntu/jenkins-aws-home/workspace/tests/test-change-dir-4:/home/ubuntu/jenkins-aws-home/workspace/tests/test-change-dir-4:rw -v /home/ubuntu/jenkins-aws-home/workspace/tests/test-change-dir-4@tmp:/home/ubuntu/jenkins-aws-home/workspace/tests/test-change-dir-4@tmp:rw -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** cloudbees/java-build-tools:0.0.7.1 cat [Pipeline] withDockerContainer { [Pipeline] sh [test-change-dir-4] Running shell script + rm -rf foo foo@tmp [Pipeline] echo >>> LS THE PARENT DIR [Pipeline] sh [test-change-dir-4] Running shell script + mkdir -p foo/bar [Pipeline] sh [test-change-dir-4] Running shell script + ls -al total 12 drwxrwxr-x 3 jenkins jenkins 4096 Mar 13 21:50 . drwxr-xr-x 4 root root 4096 Mar 13 21:50 .. drwxr-xr-x 3 jenkins jenkins 4096 Mar 13 21:50 foo [Pipeline] Change current directory : Start Running in /home/ubuntu/jenkins-aws-home/workspace/tests/test-change-dir-4/foo [Pipeline] dir { [Pipeline] echo >>> SHOULD LS THE foo DIR [Pipeline] sh [foo] Running shell script + ls -al total 16 drwxrwxr-x 4 jenkins jenkins 4096 Mar 13 21:50 . drwxr-xr-x 4 root root 4096 Mar 13 21:50 .. drwxr-xr-x 3 jenkins jenkins 4096 Mar 13 21:50 foo drwxrwxr-x 3 jenkins jenkins 4096 Mar 13 21:50 foo@tmp [Pipeline] } //dir [Pipeline] Change current directory : End
Attachments
Issue Links
- is blocked by
-
JENKINS-41474 docker.inside to rely on runC
-
- Open
-
- is blocking
-
JENKINS-35518 dir() does not change directory when used insider docker.inside block
-
- Closed
-
- is duplicated by
-
JENKINS-35406 Image.inside overrides working directory
-
- Resolved
-
-
JENKINS-55351 docker.build().inside() not run "inside" in Jenkins within Docker
-
- Closed
-
- is related to
-
JENKINS-40925 "dir" context is not honored by "sh" step
-
- Closed
-
- relates to
-
JENKINS-38331 per stage agent directives
-
- Closed
-
-
JENKINS-47305 Dir Step doesn't work inside container step when dir is outside the workspace
-
- Resolved
-
- links to
Activity
Field | Original Value | New Value |
---|---|---|
Summary | dir('foo') inside "docker.image().inside{}" creates "foo@tmp" instead of changing dir | dir('foo') inside "docker.image().inside{}" does not affect CWD of launched processes |
Remote Link | This issue links to "PR 38 (Web Link)" [ 14075 ] |
Link |
This issue is blocking |
Status | Open [ 1 ] | In Progress [ 3 ] |
Link |
This issue is duplicated by |
Workflow | JNJira [ 169439 ] | JNJira + In-Review [ 185700 ] |
Component/s | pipeline-general [ 21692 ] |
Component/s | workflow-plugin [ 18820 ] |
Component/s | pipeline [ 21692 ] |
Link | This issue is blocked by JENKINS-41474 [ JENKINS-41474 ] |
Link |
This issue is related to |
Priority | Minor [ 4 ] | Critical [ 2 ] |
Status | In Progress [ 3 ] | Open [ 1 ] |
Assignee | Jesse Glick [ jglick ] |
Epic Link | JENKINS-47962 [ 186491 ] |
Labels | cloudbees-internal-pipeline |
Remote Link | This issue links to "CloudBees Internal CD-187 (Web Link)" [ 18949 ] |
Resolution | Fixed [ 1 ] | |
Status | Open [ 1 ] | Resolved [ 5 ] |
Assignee | Nicolas De Loof [ ndeloof ] |
Link |
This issue relates to |
Link |
This issue is duplicated by |
Link |
This issue relates to |
It's not a blocker for us, we face this invoking packer and we workaround prefixing our sh 'packer ... 2>&1 | tee packer.log' call with a cd command, it looks like sh '(cd foo && packer ... 2>&1) | tee packer.log'.
cc asotobueno ndeloof