-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
RedHat Enterprise Linux 7.3
Docker 1.13.1-103.git7f2769b.el7.x86_64
Jenkins 2.204.2
Installed plugins:
ace-editor:1.1
apache-httpcomponents-client-4-api:4.5.10-2.0
authentication-tokens:1.3
branch-api:2.5.5
cloudbees-folder:6.10.1
credentials-binding:1.20
credentials:2.3.0
display-url-api:2.3.2
docker-commons:1.16
docker-workflow:1.21
durable-task:1.33
git-client:3.0.0
git-server:1.9
handlebars:1.1.1
jackson2-api:2.10.2
jquery-detached:1.2.1
jsch:0.1.55.1
junit:1.28
lockable-resources:2.7
mailer:1.29
matrix-project:1.14
momentjs:1.1.1
pipeline-build-step:2.11
pipeline-graph-analysis:1.10
pipeline-input-step:2.11
pipeline-milestone-step:1.3.1
pipeline-model-api:1.5.0
pipeline-model-declarative-agent:1.1.1
pipeline-model-definition:1.5.0
pipeline-model-extensions:1.5.0
pipeline-rest-api:2.12
pipeline-stage-step:2.3
pipeline-stage-tags-metadata:1.5.0
pipeline-stage-view:2.12
plain-credentials:1.5
scm-api:2.6.3
script-security:1.68
ssh-credentials:1.18
structs:1.20
trilead-api:1.0.5
workflow-aggregator:2.6
workflow-api:2.38
workflow-basic-steps:2.19
workflow-cps-global-lib:2.15
workflow-cps:2.78
workflow-durable-task-step:2.35
workflow-job:2.36
workflow-multibranch:2.21
workflow-scm-step:2.9
workflow-step-api:2.22
workflow-support:3.3RedHat Enterprise Linux 7.3 Docker 1.13.1-103.git7f2769b.el7.x86_64 Jenkins 2.204.2 Installed plugins: ace-editor:1.1 apache-httpcomponents-client-4-api:4.5.10-2.0 authentication-tokens:1.3 branch-api:2.5.5 cloudbees-folder:6.10.1 credentials-binding:1.20 credentials:2.3.0 display-url-api:2.3.2 docker-commons:1.16 docker-workflow:1.21 durable-task:1.33 git-client:3.0.0 git-server:1.9 handlebars:1.1.1 jackson2-api:2.10.2 jquery-detached:1.2.1 jsch:0.1.55.1 junit:1.28 lockable-resources:2.7 mailer:1.29 matrix-project:1.14 momentjs:1.1.1 pipeline-build-step:2.11 pipeline-graph-analysis:1.10 pipeline-input-step:2.11 pipeline-milestone-step:1.3.1 pipeline-model-api:1.5.0 pipeline-model-declarative-agent:1.1.1 pipeline-model-definition:1.5.0 pipeline-model-extensions:1.5.0 pipeline-rest-api:2.12 pipeline-stage-step:2.3 pipeline-stage-tags-metadata:1.5.0 pipeline-stage-view:2.12 plain-credentials:1.5 scm-api:2.6.3 script-security:1.68 ssh-credentials:1.18 structs:1.20 trilead-api:1.0.5 workflow-aggregator:2.6 workflow-api:2.38 workflow-basic-steps:2.19 workflow-cps-global-lib:2.15 workflow-cps:2.78 workflow-durable-task-step:2.35 workflow-job:2.36 workflow-multibranch:2.21 workflow-scm-step:2.9 workflow-step-api:2.22 workflow-support:3.3
When using the RedHat Docker distribution, the dir step fails.
Given this example pipeline :
pipeline { agent { docker { image 'alpine' } } stages { stage('Test') { steps { dir('test') { sh 'pwd' } } } } }
After a couple of minutes doing nothing in the dir step, the build finally fails with this error :
[Pipeline] dir Running in /home/jenkins/agent/workspace/test/test [Pipeline] { [Pipeline] sh process apparently never started in /home/jenkins/agent/workspace/test/test@tmp/durable-e1730f3c (running Jenkins temporarily with -Dorg.jenkinsci.plugins.durabletask.BourneShellScript.LAUNCH_DIAGNOSTICS=true might make the problem clearer) [Pipeline] } [Pipeline] // dir
When running Jenkins with -Dorg.jenkinsci.plugins.durabletask.BourneShellScript.LAUNCH_DIAGNOSTICS=true as suggested, it outputs more info :
[Pipeline] dir Running in /home/jenkins/agent/workspace/test/test [Pipeline] { [Pipeline] sh "--workdir" requires API version 1.35, but the Docker daemon API version is 1.26 process apparently never started in /home/jenkins/agent/workspace/test/test@tmp/durable-af2c36e9 [Pipeline] } [Pipeline] // dir
I guess the dir step has a specific behavior when running on a Docker agent and tries to use --workdir option to change directory. Unfortunately, this option is not available with Docker API < 1.35, which is the case with the RedHat distribution.
IMHO, the dir step should be agnostic of whether or not the step is running in a Docker agent.
I didn't find the piece of code that is responsible for this behavior. I would be glad to submit a PR as soon as someone helps me find it.