| OK, so I download the docker-workflow-plugin source and started hacking around and I've found a few things that get most of the plugin functionality to work on windows server 2016/windows server containers. 1. src\main\resources\org\jenkinsci\plugins\docker\workflow\Docker.groovy This groovy script has several lines that are calling the CPS 'sh' step. There should be a way to determine the platform and pass the docker command to 'sh' on linux, or 'bat' on windows. For testing purposes I swapped all sh with bat. 2. src\main\java\org\jenkinsci\plugins\docker\workflow\client\DockerClient.java The whoAmI method calls the 'id' utility on linux to determine the GID/UID of the current user. The docker client appends '-u [user]' when starting the container. I don't know if windows has the same behavior of using a SID in the container that matches a user on the windows host, so I commented out this code, returned null, as well as remove -u option from run for testing purposes. 3. src\main\java\org\jenkinsci\plugins\docker\workflow\WithContainerStep.java There's a hardcoded 'cat' command that the container starts with. I changed this to 'cmd' for windows. With these three changes, I was able to successfully pull microsoft/windowsservercore, run the container, then have it stopped and removed. I'm sure build, tag, push would have worked as well, but I didn't get around to testing those features. Unfortunately, if I try to run 'bat' in docker.image().inside{}, the process hangs indefinitely. The WithContainerStep Decorator decorate() is getting called, and the return statement is executed 'return super.launch(starter);', but then trying to debug the durable task, groovy cps, and others was difficult for me. |