-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
Pipeline basic steps: 2.3
Docker pipeline: 1.9.1
Jenkins: 2.19.3
This snippet (with docker.image.inside) fails:
node('default') { docker.image('builder').inside { deleteDir() checkout scm sh 'git rev-parse HEAD > git-revision.tmp' env.REVISION = readFile('git-revision.tmp').trim() } }
While this snippet doesn't:
node('default') { deleteDir() checkout scm sh 'git rev-parse HEAD > git-revision.tmp' env.REVISION = readFile('git-revision.tmp').trim() }
The failure begins with the attempt to use the checked out files, with this error:
[Pipeline] sh [FLE3OSMVFPS5YXYDBJO2SDKESHOZUWIWXDMRIPXDFZ27TAUUNB6Q] Running shell script shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory + git rev-parse HEAD job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory /home/jenkins/workspace/-FLE3OSMVFPS5YXYDBJO2SDKESHOZUWIWXDMRIPXDFZ27TAUUNB6Q@tmp/durable-f4c5cca7/script.sh: line 2: git-revision.tmp: No such file or directory Raw
deleteDir() calls hudson.FilePath.deleteRecursive() which "Deletes this directory, including all its contents recursively."
Somehow when not working with docker, the pipeline recovers from this situation. But when doing that in a docker image, it fails.