docker-workflow-plugin icon indicating copy to clipboard operation
docker-workflow-plugin copied to clipboard

JENKINS-60473 Containerize workspace paths when running Linux container on Windows host

Open mrsonicblue opened this issue 5 years ago • 6 comments

This attempts to address this reported issue:

https://issues.jenkins-ci.org/browse/JENKINS-60473

The main problem is that the plugin uses the host's absolute path for the workspace as a volume mount in the Docker container. This works fine when the OS matches between host and container (e.g., Linux/Linux or Windows/Windows). When running Linux containers on a Windows host, the Windows-style paths (with a drive letter) are not valid.

The code change in this fork detects that it's a mixed environment and converts workspace paths to Linux-compatible versions. This is running in production for my use-case, but it has not been robustly tested.

mrsonicblue avatar Jan 01 '20 23:01 mrsonicblue

I tested the branch on my Windows Host with execution the pipline example from Using Docker with Pipeline pipeline { agent { docker { image 'node:7-alpine' } } stages { stage('Test') { steps { sh 'node --version' } } } }

It results in an Error Message: 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

More information i wrote also here: JENKINS-60473 Is there a possibility, to get the Feature "Executing Linux Docker Container on Windows Host also working?" My assumption is that the changes are only working, when you have a 2 Node Setup with a Jenkins Master running on Linux and a Jenkins Slave running on Windows. In my case i have only a Jenkins Master which is running on Windows, which executes the Linux Docker Container direct.

Bobby862 avatar Jan 20 '20 16:01 Bobby862

@oleg-nenashev how can we make this merge happen ?

j-p-e avatar Dec 22 '21 16:12 j-p-e

Added to my list

oleg-nenashev avatar Dec 24 '21 12:12 oleg-nenashev

Any update here? Seems like this was ready to merge but abandoned, but the issue still remains

mneumei avatar Jun 22 '22 04:06 mneumei

This plugin is generally unmaintained and I do not recommend you use it. Instead directly run docker CLI commands from a build script. Windows-specific issues are particularly risky since we have no CI coverage.

jglick avatar Dec 01 '22 23:12 jglick

Sorry if necrobumping but any update on this? This feature would greatly streamline my build process.

ljbkusters avatar Apr 17 '24 08:04 ljbkusters