docker-workflow-plugin
docker-workflow-plugin copied to clipboard
JENKINS-60473 Containerize workspace paths when running Linux container on Windows host
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.
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.
@oleg-nenashev how can we make this merge happen ?
Added to my list
Any update here? Seems like this was ready to merge but abandoned, but the issue still remains
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.
Sorry if necrobumping but any update on this? This feature would greatly streamline my build process.