[JIRA] (JENKINS-60473) Docker pipeline: 'absolute path' error when running linux container under windows host

27 views
Skip to first unread message

pkruk@parasoft.com (JIRA)

unread,
Dec 20, 2019, 4:58:03 AM12/20/19
to jenkinsc...@googlegroups.com
Piotr Krukowiecki updated an issue
 
Jenkins / Bug JENKINS-60473
Docker pipeline: 'absolute path' error when running linux container under windows host
Change By: Piotr Krukowiecki
Summary: Docker pipeline: 'absolute path' error when running docker linux container under windows host
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

mr.sonicblue@gmail.com (JIRA)

unread,
Dec 20, 2019, 8:28:02 AM12/20/19
to jenkinsc...@googlegroups.com
Eric Schneider edited a comment on Bug JENKINS-60473
 
Re: Docker pipeline: 'absolute path' error when running linux container under windows host
I've been trying to track this issue. It's a bit of a surprise because there was a big push recently to get Docker Windows supported in version 1.21 of the plugin. The effort culminated in this pull request:

[https://github.com/jenkinsci/docker-workflow-plugin/pull/184]

I was racking my brain trying to figure out how this was so thoroughly tested, but this path issue exists. The best I can tell, anyone who successfully tested these changes was running Windows containers on a Windows host. In that scenario the paths would be valid for both the host and the container. The error reported here happens when you run Linux containers on a Windows host. An elegant fix for this would be challenging because the environment would need to be checked to see what type of containers Docker is currently configured to run.

mr.sonicblue@gmail.com (JIRA)

unread,
Dec 20, 2019, 8:36:04 AM12/20/19
to jenkinsc...@googlegroups.com

I've started to make code changes in my environment to investigate how deep this issue is. I updated the WindowsDockerClient class to change the volume and workDir parameters to have Linux-friendly paths. This clears the issue reported here, but hits a new wall.

I'm testing using withDockerContainer. This function runs cmd.exe to intentially keep the container running indefinitely, but this doesn't exist in Linux containers. Changing it to run 'cat' clears this error and the docker container starts.

Next, it reports that 'cat' isn't running in the container. This is likely due to a different implementation of listProcess in WindowsDockerClient. I'm ignoring this because it seems to just be a warning.

Finally, when my pipeline script attempts to run sh within the container, it freezes indefinitely. I need to manually kill the docker container. I haven't had time to troubleshoot this issue yet.

roberthecker@googlemail.com (JIRA)

unread,
Dec 20, 2019, 9:29:02 AM12/20/19
to jenkinsc...@googlegroups.com

I'm not sure if i get you correct, but in my understanding the problem is happening only on Windows host (master or slaves), when they try to start a Linux container with a Jenkins Pipeline as you wrote in the first comment.

Are you exectuing the Test on a Windows host, with a Linux Docker Container? I don't get the point what you mean with 'cat', because if the commandline is correct, and Jenkins will start the Linux Container on the host, my expectation would be that it will run with the exactly same behaviour as if i would run it on my commandline on the host directly. 

For sure, now the Test Steps can not more run inside a cmd or bat command, because the jenkins should execute now the command as shell. But if we use the Jenkinsfile like this:

pipeline {
    agent {
        docker { image 'node:7-alpine' }
    }
    stages {
        stage('Test') {
            steps {
                sh 'node --version'
            }
        }
    }
}

then it is already written, that a Linux container is started, and inside the Linux node we call the command sh 'node --version'.

In my understanding the challenge is to transfer the single 'sh' calls from a windows host where we have to use cmd to inside the docker container, and this via a opened cmd, where the docker container is already started.

I'm currently not able to help here in coding, but it would be great to have a solution available which works, but what i can offer currently is the help to perform tests, if this would help here. Maybe also more would be possible, but i'm not familiar with the whole development environment for jenkins currently.

mr.sonicblue@gmail.com (JIRA)

unread,
Dec 20, 2019, 12:30:02 PM12/20/19
to jenkinsc...@googlegroups.com

Robert Hecker

I'm referencing a "behind the scenes" aspect about how the docker functionality works. When you enter into a pipeline region where you're running commands inside the docker container, Jenkins will start the docker container and it stays running until you leave that code region. So the order of operations for your sample that runs "node --version" is this:

  • Start the docker container
  • Run "node --version" inside the container
  • Stop the docker container

The method that is used to start the container is a command is run that would never quit. For Linux it runs 'cat' and for Windows it runs 'cmd.exe'. Here is the relevant code from the docker workflow plugin:

String command = launcher.isUnix() ? "cat" : "cmd.exe";
container = dockerClient.run(env, step.image, step.args, ws, volumes, volumesFromContainers, envReduced, dockerClient.whoAmI(), /* expected to hang until killed */ command);

The issue with this is it makes the decision based on the host environment and not the container environment. This decision is baked into the plugin and isn't based on input from the pipeline script. If you're on Windows and trying to run a Linux container, it always chooses to run cmd.exe.

mr.sonicblue@gmail.com (JIRA)

unread,
Dec 23, 2019, 8:51:03 AM12/23/19
to jenkinsc...@googlegroups.com

I looked further into the indefinite freezing that I mentioned in a previous comment. My changes to the volume and working directory paths do result in the docker container starting successfully. The freeze is happening during the 'sh' command since the withDockerContainer block. The 'sh' command generates a really complex inline script to track the progress of the command and capture its output. The script's command also gets written to a file and is referenced. There are multiple absolute path references which use Windows's format. These fail on the Linux side and, because no output is written to the proper location, the 'sh' command waits indefinitely for it to finish. (It will eventually time out, but would otherwise wait forever.) If I capture the command in the Jenkins logs and rework all of the paths to be Linux-friendly, the command runs in docker successfully and Jenkins immediately moves to the next pipeline command/step.

I tried to leverage the 'ws' command to force a Linux-friendly path inside the withDockerContainer block, but this causes new problems. Namely it causes the host-side of the 'sh' command to work in the wrong place - causing the same end result. You MIGHT be able to mostly work around this problem by using a Linux-friend path (like "/Jenkins") for the workspace root for the Windows node... but some of the commands may still use backslashes for path separators and cause failures. It's also not a user-friendly solution.

At minimum, it seems like the Decorator class used by withDockerContainer needs to comb through the launcher's commands list ("cmds") and replace all of the Windows paths with Linux-friendly paths. A regular expression might be able to do it, but I haven't tried yet. It's tricky with the amount of text being added to the command list. Maybe someone with more knowledge of Jenkins has a more elegant solution.

mr.sonicblue@gmail.com (JIRA)

unread,
Jan 1, 2020, 6:07:03 PM1/1/20
to jenkinsc...@googlegroups.com

I created a fork which contains changes that resolve this issue for my use case. I'd be curious if anyone else could test the changes.

https://github.com/mrsonicblue/docker-workflow-plugin

ralphjco@gmail.com (JIRA)

unread,
Jan 2, 2020, 1:13:04 PM1/2/20
to jenkinsc...@googlegroups.com

Hi Eric,

I have run into the same issue as the original poster. I would like to test your fork - how do I integrate this plugin into Jenkins?

ralphjco@gmail.com (JIRA)

unread,
Jan 2, 2020, 1:15:03 PM1/2/20
to jenkinsc...@googlegroups.com
Ralph Connors edited a comment on Bug JENKINS-60473
Hi Eric,

I have run into the same issue as the original poster. I would like to test your fork - how do I integrate
this the plugin on Github into Jenkins?

mr.sonicblue@gmail.com (JIRA)

unread,
Jan 2, 2020, 8:14:02 PM1/2/20
to jenkinsc...@googlegroups.com

Ralph Connors

I'm going to email you a link to a built version of the code. I don't know if I should post a direct link here. But if you're willing to give it a try:

You can upload the plugin by navigating "Manage Jenkins" > "Manage Plugins" > "Advanced" tab > "Upload Plugin". Make sure you only do it once, because the Jenkins interface will let you revert back one version, but not more than one. You can revert back to the standard plugin if my build makes things worse.

roberthecker@googlemail.com (JIRA)

unread,
Jan 3, 2020, 11:12:03 AM1/3/20
to jenkinsc...@googlegroups.com

Hi Eric,

when you send me a link to your build version of your plugin, i can test it also on my environment.

Please let me know, if i can help.

roberthecker@googlemail.com (JIRA)

unread,
Jan 3, 2020, 3:40:01 PM1/3/20
to jenkinsc...@googlegroups.com

Hi Eric,

Thank you very much for your effort, and the upload of the modified source code of the docker plugin.

1.) I managed to get the plugin on my pc compiled.

2.) I used fro a test following pipeline as example:

pipeline {
    agent {
        docker { image 'node:7-alpine' }
    }
    stages {
        stage('Test') {
            steps {
                sh 'node --version'
            }
        }
    }
}

3)Test execution is resulting in a failure (Exit Code -2):

C:\Program Files (x86)\Jenkins\workspace\docker-jenkins-test_master>docker inspect -f . node:7-alpine 
.
[Pipeline] withDockerContainer
Jenkins does not seem to be running inside a container
$ docker run -d -t -w "/c/Program Files (x86)/Jenkins/workspace/docker-jenkins-test_master/" -v "C:/Program Files (x86)/Jenkins/workspace/docker-jenkins-test_master/:/c/Program Files (x86)/Jenkins/workspace/docker-jenkins-test_master/" -v "C:/Program Files (x86)/Jenkins/workspace/docker-jenkins-test_master@tmp/:/c/Program Files (x86)/Jenkins/workspace/docker-jenkins-test_master@tmp/" -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** node:7-alpine cat
$ docker top ee78f93ed896282757e96f87cc6c73210b63e14f4a6bdc94f229db4468721db1
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Test)
[Pipeline] sh
process apparently never started in C:\Program Files (x86)\Jenkins\workspace\docker-jenkins-test_master@tmp\durable-275a00eb
(running Jenkins temporarily with -Dorg.jenkinsci.plugins.durabletask.BourneShellScript.LAUNCH_DIAGNOSTICS=true might make the problem clearer)
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
$ docker stop --time=1 ee78f93ed896282757e96f87cc6c73210b63e14f4a6bdc94f229db4468721db1
$ docker rm -f ee78f93ed896282757e96f87cc6c73210b63e14f4a6bdc94f229db4468721db1
[Pipeline] // withDockerContainer
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code -2
Finished: FAILURE

4) Is the docker option "-v" correct? (-v "C:/Program Files (x86)/Jenkins/workspace/docker-jenkins-test_master/:/c/Program Files (x86)/Jenkins/workspace/docker-jenkins-test_master/") The bold marked path looks like an windows path, but does this path work inside a linux container ? 

roberthecker@googlemail.com (JIRA)

unread,
Jan 3, 2020, 3:41:02 PM1/3/20
to jenkinsc...@googlegroups.com
Robert Hecker edited a comment on Bug JENKINS-60473
Hi Eric,

Thank you very much for your effort, and the upload of the modified source code of the docker plugin.

1.) I managed to get the plugin on my pc compiled.

2.) I used fro for a test following pipeline as example: (From: [https://jenkins.io/doc/book/pipeline/docker/])
{code:java}

pipeline {
    agent {
        docker { image 'node:7-alpine' }
    }
    stages {
        stage('Test') {
            steps {
                sh 'node --version'
            }
        }
    }
}
{code}

3)Test execution is resulting in a failure (Exit Code -2):
{code:java}
{code}
4) Is the docker option "-v" correct? (-v "C:/Program Files (x86)/Jenkins/workspace/docker-jenkins-test_master/:*/c/Program Files (x86)/Jenkins/workspace/docker-jenkins-test_master/*") The bold marked path looks like an windows path, but does this path work inside a linux container ? 

mr.sonicblue@gmail.com (JIRA)

unread,
Jan 5, 2020, 1:19:02 PM1/5/20
to jenkinsc...@googlegroups.com

Robert Hecker

Thank you for the detailed notes. When I run your pipeline example, it does work for me. I need to figure out what's different in your environment.

The path that you bolded is correct. If you look at the "docker run" command in the log, you can see that the workspace path from the Windows host is being mounted via a volume to that path in the Linux container. The path is translated into something Linux-friendly. For example: C:\this\path becomes /c/this/path. Even though your path is is Windows-y, it doesn't really matter. The path can be arbitrary.

What's unfortunate is that the sh command doesn't output the command it runs into the job log. It's difficult to capture. I'm including directions here in case you want to try. Navigate to "Managed Jenkins" > "System Log" > "Add new log recorder". Give it any name and click "OK". Under "Loggers" add "hudson" and "org.jenkinsci.plugins". Ensure that the log level is "ALL" for both. Save the recorder. This should open the log. Run your test job and right when it gets to the 'sh' step, refresh the log. Search the output for "docker" and see if you can find the "docker exec" line in the log. It can be hard to capture, since the log only shows a small number of lines. Here's an example from my log:

docker exec --env BUILD_DISPLAY_NAME=#4 --env BUILD_ID=4 --env BUILD_NUMBER=4 --env BUILD_TAG=jenkins-Parenthesis Test (wee)-4 --env BUILD_URL=http://example.com/job/Parenthesis%20Test%20(wee)/4/ --env CLASSPATH= --env EXECUTOR_NUMBER=2 --env HUDSON_HOME=/var/lib/jenkins --env HUDSON_SERVER_COOKIE=a78bfd62731ccf0a --env HUDSON_URL=http://example.com/ --env JENKINS_NODE_COOKIE=06d630b9-7764-43ee-85e0-eb9a26bcc2d2 --env JENKINS_SERVER_COOKIE=please-do-not-kill-me --env JENKINS_URL=http://example.com/ --env JOB_BASE_NAME=Parenthesis Test (wee) --env JOB_DISPLAY_URL=http://example.com/job/Parenthesis%20Test%20(wee)/display/redirect --env JOB_NAME=Parenthesis Test (wee) --env JOB_URL=http://example.com/job/Parenthesis%20Test%20(wee)/ --env NODE_LABELS=localhost master --env NODE_NAME=master --env RUN_CHANGES_DISPLAY_URL=http://example.com/job/Parenthesis%20Test%20(wee)/4/display/redirect?page=changes --env RUN_DISPLAY_URL=http://example.com/job/Parenthesis%20Test%20(wee)/4/display/redirect --env STAGE_NAME=Test --env WORKSPACE=/var/lib/jenkins/workspace/Parenthesis Test (wee) --env library.migration-library.version=master 63c3793d8f3730cafcc37fb3e495d25ec8e520d12cf9a599342697fc64616393 nohup sh -c ({ while [ -d '/var/lib/jenkins/workspace/Parenthesis Test (wee)@tmp/durable-11d2bcc9' -a \! -f '/var/lib/jenkins/workspace/Parenthesis Test (wee)@tmp/durable-11d2bcc9/jenkins-result.txt' ]; do touch '/var/lib/jenkins/workspace/Parenthesis Test (wee)@tmp/durable-11d2bcc9/jenkins-log.txt'; sleep 3; done } & jsc=durable-27a2324005ef9d26531c4508bfcb22d4; JENKINS_SERVER_COOKIE=$jsc 'sh' -xe  '/var/lib/jenkins/workspace/Parenthesis Test (wee)@tmp/durable-11d2bcc9/script.sh' > '/var/lib/jenkins/workspace/Parenthesis Test (wee)@tmp/durable-11d2bcc9/jenkins-log.txt' 2>&1; echo $? > '/var/lib/jenkins/workspace/Parenthesis Test (wee)@tmp/durable-11d2bcc9/jenkins-result.txt.tmp'; mv '/var/lib/jenkins/workspace/Parenthesis Test (wee)@tmp/durable-11d2bcc9/jenkins-result.txt.tmp' '/var/lib/jenkins/workspace/Parenthesis Test (wee)@tmp/durable-11d2bcc9/jenkins-result.txt'; wait) >&- 2>&- &

This would be the command where the job gets stuck and needs to be troubleshooted. You can try running this manually on your node to see if it returns a meaningful message.

mr.sonicblue@gmail.com (JIRA)

unread,
Jan 5, 2020, 1:27:03 PM1/5/20
to jenkinsc...@googlegroups.com
Eric Schneider edited a comment on Bug JENKINS-60473
[~bobby013]


Thank you for the detailed notes. When I run your pipeline example, it does work for me. I need to figure out what's different in your environment.

The path that you bolded is correct. If you look at the "docker run" command in the log, you can see that the workspace path from the Windows host is being mounted via a volume to that path in the Linux container. The path is translated into something Linux-friendly. For example: C:\this\path becomes /c/this/path. Even though your path is is Windows-y, it doesn't really matter. The path can be arbitrary.

What's unfortunate is that the sh command doesn't output the command it runs into the job log. It's difficult to capture. I'm including directions here in case you want to try. Navigate to "Managed Jenkins" > "System Log" > "Add new log recorder". Give it any name and click "OK". Under "Loggers" add "hudson" and "org.jenkinsci.plugins". Ensure that the log level is "ALL" for both. Save the recorder. This should open the log. Run your test job and right when it gets to the 'sh' step, refresh the log. Search the output for "docker" and see if you can find the "docker exec" line in the log. It can be hard to capture, since the log only shows a small number of lines. Here's an example from my log:
{ noformat code:java }

docker exec --env BUILD_DISPLAY_NAME=#4 --env BUILD_ID=4 --env BUILD_NUMBER=4 --env BUILD_TAG=jenkins-Parenthesis Test (wee)-4 --env BUILD_URL=http://example.com/job/Parenthesis%20Test%20(wee)/4/ --env CLASSPATH= --env EXECUTOR_NUMBER=2 --env HUDSON_HOME=/var/lib/jenkins --env HUDSON_SERVER_COOKIE=a78bfd62731ccf0a --env HUDSON_URL=http://example.com/ --env JENKINS_NODE_COOKIE=06d630b9-7764-43ee-85e0-eb9a26bcc2d2 --env JENKINS_SERVER_COOKIE=please-do-not-kill-me --env JENKINS_URL=http://example.com/ --env JOB_BASE_NAME=Parenthesis Test (wee) --env JOB_DISPLAY_URL=http://example.com/job/Parenthesis%20Test%20(wee)/display/redirect --env JOB_NAME=Parenthesis Test (wee) --env JOB_URL=http://example.com/job/Parenthesis%20Test%20(wee)/ --env NODE_LABELS=localhost master --env NODE_NAME=master --env RUN_CHANGES_DISPLAY_URL=http://example.com/job/Parenthesis%20Test%20(wee)/4/display/redirect?page=changes --env RUN_DISPLAY_URL=http://example.com/job/Parenthesis%20Test%20(wee)/4/display/redirect --env STAGE_NAME=Test --env WORKSPACE=/var/lib/jenkins/workspace/Parenthesis Test (wee) --env library.migration-library.version=master 63c3793d8f3730cafcc37fb3e495d25ec8e520d12cf9a599342697fc64616393 nohup sh -c ({ while [ -d '/var/lib/jenkins/workspace/Parenthesis Test (wee)@tmp/durable-11d2bcc9' -a \! -f '/var/lib/jenkins/workspace/Parenthesis Test (wee)@tmp/durable-11d2bcc9/jenkins-result.txt' ]; do touch '/var/lib/jenkins/workspace/Parenthesis Test (wee)@tmp/durable-11d2bcc9/jenkins-log.txt'; sleep 3; done } & jsc=durable-27a2324005ef9d26531c4508bfcb22d4; JENKINS_SERVER_COOKIE=$jsc 'sh' -xe  '/var/lib/jenkins/workspace/Parenthesis Test (wee)@tmp/durable-11d2bcc9/script.sh' > '/var/lib/jenkins/workspace/Parenthesis Test (wee)@tmp/durable-11d2bcc9/jenkins-log.txt' 2>&1; echo $? > '/var/lib/jenkins/workspace/Parenthesis Test (wee)@tmp/durable-11d2bcc9/jenkins-result.txt.tmp'; mv '/var/lib/jenkins/workspace/Parenthesis Test (wee)@tmp/durable-11d2bcc9/jenkins-result.txt.tmp' '/var/lib/jenkins/workspace/Parenthesis Test (wee)@tmp/durable-11d2bcc9/jenkins-result.txt'; wait) >&- 2>&- &

{ noformat code }

This would be the command where the job gets stuck and needs to be troubleshooted. You can try running this manually on your node to see if it returns a meaningful message.

roberthecker@googlemail.com (JIRA)

unread,
Jan 7, 2020, 3:20:02 AM1/7/20
to jenkinsc...@googlegroups.com

Hi Eric,

unfortunatly i do not find a "docker exec" string in my log, and i do not find the correct positions in the log, to interpret what is going on. So i will attach my complete log to this comment, in the hope, that you are able to get the needed informations. When i read your answer, it comes to my mind, that my setup is maybe different from yours, so here some additional informations about my setup:

I'm running a jenkins installation on windows10, and directly on this master i try to execute this docker pipeline example (From: https://jenkins.io/doc/book/pipeline/docker/) Maybe this is an big difference to your setup, because i assume now you have a jenkins master installed in linux, and execute your job an a windows slave. If my assumption is correct, i hope this gives you a hint, where the problems could be. Here the log file: Jenkins_Log.zip

roberthecker@googlemail.com (JIRA)

unread,
Jan 7, 2020, 3:20:02 AM1/7/20
to jenkinsc...@googlegroups.com

roberthecker@googlemail.com (JIRA)

unread,
Jan 7, 2020, 3:52:03 AM1/7/20
to jenkinsc...@googlegroups.com
Robert Hecker edited a comment on Bug JENKINS-60473
Hi Eric,

unfortunatly i do not find a "*docker exec*" string in my log, and i do not find the correct positions in the log, to interpret what is going on. So i will attach my complete log to this comment, in the hope, that you are able to get the needed informations. When i read your answer, it comes to my mind, that my setup is maybe different from yours, so here some additional informations about my setup:

I'm running a jenkins installation on windows10, and directly on this master i try to execute this docker pipeline example (From: [https://jenkins.io/doc/book/pipeline/docker/]) Maybe this is an big difference to your setup, because i assume now you have a jenkins master installed in linux, and execute your job an a windows slave. If my assumption is correct, i hope this gives you a hint, where the problems could be. Here the log file: [^Jenkins_Log.zip]


 

^When i start the docker command fom the jenkins console output log manualy and type in the docker top command it locks like following:^
{code:java}
D:\>docker run -d -t -w "/c/Program Files (x86)/Jenkins/workspace/docker-jenkins-test_master/" -v "C:/Program Files (x86)/Jenkins/workspace/docker-jenkins-test_master/:/c/Program Files (x86)/Jenkins/workspace/docker-jenkins-test_master/" -v "C:/Program Files (x86)/Jenkins/workspace/docker-jenkins-test_master@tmp/:/c/Program Files (x86)/Jenkins/workspace/docker-jenkins-test_master@tmp/" -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** node:7-alpine cat
e735b5e12baebfe12af2e56bea9fd031f088503d835a343b21ecb876b5caf18b

D:\>docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
e735b5e12bae        node:7-alpine       "cat"                    11 seconds ago      Up 10 seconds                     crazy_johnson

D:\>docker top e735b5e12baebfe12af2e56bea9fd031f088503d835a343b21ecb876b5caf18b
PID                 USER                TIME                COMMAND
5093                root                0:00                cat

D:\>
{code}
So it looks like the container started, and also the internal process with the PID 5093 is running. I'm wondering, why in the jenkins console log is mentioned "*process apparently never started in ...*"
{code:java}

[Pipeline] {
[Pipeline] stage
[Pipeline] { (Test)
[Pipeline] sh
process apparently never started in C:\Program Files (x86)\Jenkins\workspace\docker-jenkins-test_master@tmp\durable-7243594c

(running Jenkins temporarily with -Dorg.jenkinsci.plugins.durabletask.BourneShellScript.LAUNCH_DIAGNOSTICS=true might make the problem clearer)
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
{code}
So it could be that Jenkins realy never started the "docker exec" command on my Windows Machine.

roberthecker@googlemail.com (JIRA)

unread,
Jan 7, 2020, 4:03:03 AM1/7/20
to jenkinsc...@googlegroups.com

Hi Eric Schneider,

When i try to run the command manualy on my windows machine, where i manualy started the container like above, i get following error code:

D:\>docker exec --env BUILD_DISPLAY_NAME=#4 --env BUILD_ID=4 --env BUILD_NUMBER=4 --env BUILD_TAG=jenkins-Parenthesis Test (wee)-4 --env BUILD_URL=http://example.com/job/Parenthesis%20Test%20(wee)/4/ --env CLASSPATH= --env EXECUTOR_NUMBER=2 --env HUDSON_HOME=/var/lib/jenkins --env HUDSON_SERVER_COOKIE=a78bfd62731ccf0a --env HUDSON_URL=http://example.com/ --env JENKINS_NODE_COOKIE=06d630b9-7764-43ee-85e0-eb9a26bcc2d2 --env JENKINS_SERVER_COOKIE=please-do-not-kill-me --env JENKINS_URL=http://example.com/ --env JOB_BASE_NAME=Parenthesis Test (wee) --env JOB_DISPLAY_URL=http://example.com/job/Parenthesis%20Test%20(wee)/display/redirect --env JOB_NAME=Parenthesis Test (wee) --env JOB_URL=http://example.com/job/Parenthesis%20Test%20(wee)/ --env NODE_LABELS=localhost master --env NODE_NAME=master --env RUN_CHANGES_DISPLAY_URL=http://example.com/job/Parenthesis%20Test%20(wee)/4/display/redirect?page=changes --env RUN_DISPLAY_URL=http://example.com/job/Parenthesis%20Test%20(wee)/4/display/redirect --env STAGE_NAME=Test --env WORKSPACE=/var/lib/jenkins/workspace/Parenthesis Test (wee) --env library.migration-library.version=master 63c3793d8f3730cafcc37fb3e495d25ec8e520d12cf9a599342697fc64616393 nohup sh -c ({ while [ -d '/var/lib/jenkins/workspace/Parenthesis Test (wee)@tmp/durable-11d2bcc9' -a \! -f '/var/lib/jenkins/workspace/Parenthesis Test (wee)@tmp/durable-11d2bcc9/jenkins-result.txt' ]; do touch '/var/lib/jenkins/workspace/Parenthesis Test (wee)@tmp/durable-11d2bcc9/jenkins-log.txt'; sleep 3; done } & jsc=durable-27a2324005ef9d26531c4508bfcb22d4; JENKINS_SERVER_COOKIE=$jsc 'sh' -xe '/var/lib/jenkins/workspace/Parenthesis Test (wee)@tmp/durable-11d2bcc9/script.sh' > '/var/lib/jenkins/workspace/Parenthesis Test (wee)@tmp/durable-11d2bcc9/jenkins-log.txt' 2>&1; echo $? > '/var/lib/jenkins/workspace/Parenthesis Test (wee)@tmp/durable-11d2bcc9/jenkins-result.txt.tmp'; mv '/var/lib/jenkins/workspace/Parenthesis Test (wee)@tmp/durable-11d2bcc9/jenkins-result.txt.tmp' '/var/lib/jenkins/workspace/Parenthesis Test (wee)@tmp/durable-11d2bcc9/jenkins-result.txt'; wait) >&- 2>&- &
">&" kann syntaktisch an dieser Stelle nicht verarbeitet werden.

To get the expected output i tried it with this "docker exec" command:

D:\>docker exec -it e735b5e12baebfe12af2e56bea9fd031f088503d835a343b21ecb876b5caf18b node --version
v7.10.1

This delivered me the expected version information as output. Hope this information help you for your investigation.  !

roberthecker@googlemail.com (JIRA)

unread,
Jan 15, 2020, 7:08:02 AM1/15/20
to jenkinsc...@googlegroups.com

Hello Together,

in the meantime i found more details why it is not working on a Jenkins Master which is installed on Windows. I got now extended messages on the execution log, which points more clearer to the Problem. The interesting part of the log is:

[Pipeline] withDockerContainer
Jenkins does not seem to be running inside a container
$ docker run -d -t -w /d/Sandbox_GIT/Jenkins_Plugin/docker-workflow-plugin-master/work/workspace/test/ -v D:/Sandbox_GIT/Jenkins_Plugin/docker-workflow-plugin-master/work/workspace/test/:/d/Sandbox_GIT/Jenkins_Plugin/docker-workflow-plugin-master/work/workspace/test/ -v D:/Sandbox_GIT/Jenkins_Plugin/docker-workflow-plugin-master/work/workspace/test@tmp/:/d/Sandbox_GIT/Jenkins_Plugin/docker-workflow-plugin-master/work/workspace/test@tmp/ -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** node:7-alpine cat
$ docker top 0c8e23cea55f3e827eb013a74fed9b28e0585a5a243bef9ec897441dfc320a60
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Test)
[Pipeline] sh
sh: can't create /d/Sandbox_GIT/Jenkins_Plugin/docker-workflow-plugin-master/work/workspace/test@tmp/durable-f0f56139/jenkins-log.txt: nonexistent directory
sh: can't create /d/Sandbox_GIT/Jenkins_Plugin/docker-workflow-plugin-master/work/workspace/test@tmp/durable-f0f56139/jenkins-result.txt.tmp: nonexistent directory
mv: can't rename '/d/Sandbox_GIT/Jenkins_Plugin/docker-workflow-plugin-master/work/workspace/test@tmp/durable-f0f56139/jenkins-result.txt.tmp': No such file or directory
process apparently never started in D:\Sandbox_GIT\Jenkins_Plugin\docker-workflow-plugin-master\work\workspace\test@tmp\durable-f0f56139
[Pipeline] }

For me it seems that some folders are not existing, and due this he can not create the file. 

Following 2 Folders exist on my Windows Master:

  • D:\Sandbox_GIT\Jenkins_Plugin\docker-workflow-plugin-master\work\workspace\test
  • D:\Sandbox_GIT\Jenkins_Plugin\docker-workflow-plugin-master\work\workspace\test@tmp

What needs to be changed in the Plugin, to get this working?

roberthecker@googlemail.com (JIRA)

unread,
Jan 17, 2020, 8:15:18 AM1/17/20
to jenkinsc...@googlegroups.com

i saw that the subdirectories on the Windows host where created ("\durable-f0f56139") and a .sh script is inside there with the command from the pipeline *"node --version" is inside.

So the next question would be where, and with which parameters does the plugin call the docker exec command? 

Can this found in a jenkins log ? When yes, how to configure the log to get this information ?

Any help would be great! Thanks a lot in advance!

Reply all
Reply to author
Forward
0 new messages