-
Notifications
You must be signed in to change notification settings - Fork 322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP/RFC fix windows containers - ensureWaiting/injection of the agent #872
base: master
Are you sure you want to change the base?
Conversation
Hmm, yes, that admission from Hyper-V that ...hmm... that said ... it may be as simple as switching the code from doing the injection in the So, what I'd suggest is that you make a PR (or change this PR) that switches the jar injection to ...and, if you're interested in having the docker-plugin work on Windows then, ideally, you'd then go on to submit a PR to improve the unit-tests so that they don't skip all the io.jenkins.docker.connector tests when on Windows, so that way we can get automated tests for Windows too (assuming that the Jenkins CI system gives us Windows VMs that have docker capability, that is). |
.withAttachStdin(false); | ||
// on windows we can't rely on /bin/sh being present, so we use cmd.exe to ensure a process is waiting | ||
// TODO: same here, refined detection mechanism if possible | ||
if(workdir.matches("^.:.*")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pjdarton What about this bit here? Maybe we can work around this by allowing the "waiting" cmd to be customized? This way we could default to /bin/sh and the admin/user of the plugin can change it to $whatever.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CMD field can be set in the template definition.
While it might be nice to have the code set a Windows-compatible default, it's not essential as the user can specify one themselves.
i.e. this can be addressed in the help text.
Thank you very much for the review! I totally agree on your course of action - i will try to look at the unittests too, but can't promise anything. |
This is a draft PR which should not be merged just yet. Hence i ignored the template for now, this should be for discussions/strategy planing first, then I will rework this PR into a proper state.
We run a Jenkins instance with a Docker Cloud configured with windows containers, we discovered that there are two blocking issues preventing windows containers from being started when Hyper-V Virtualization is enabled:
The branch in this PR solves both problems in a "hacky" way.
Detection if it is a windows container is done by checking the workdir for existence of "^.:" indicating a structure similar to C:\bla.
This I find not too nice but I could not devise a better scheme yet. This should maybe moved to a more global State for a given Container, so we have a single Place to check this.
The second part is the handling of injection, currently in my PR when I see its a Windows container I inject before start other whise after. The question here is.. The beforeContainerStarted callback explicitly advises that it is a good place for injecting the Jar, why is it done in afterContainerStarted? I did not change this because i assume there must be a reason for this.
I attached TODO markers at all points where i seek clarification.
My tests where done on default unchanged linux(jenkins/agent:latest) and windows(jenkins/agent:jdk11-windowsservercore-ltsc2019) containers.
Thank you for your time.