[JIRA] (JENKINS-61145) dir() step fails with docker agent when API version is prior to 1.35

0 views
Skip to first unread message

eric.citaire@gmail.com (JIRA)

unread,
Feb 19, 2020, 6:59:03 AM2/19/20
to jenkinsc...@googlegroups.com
Eric Citaire created an issue
 
Jenkins / Bug JENKINS-61145
dir() step fails with docker agent when API version is prior to 1.35
Issue Type: Bug Bug
Assignee: Carlos Sanchez
Components: docker, pipeline
Created: 2020-02-19 11:58
Environment: 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.3
Priority: Major Major
Reporter: Eric Citaire

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.

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages