-
Notifications
You must be signed in to change notification settings - Fork 408
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
feat/windows slaves #148
feat/windows slaves #148
Conversation
import hudson.LauncherDecorator; | ||
import hudson.Proc; | ||
import hudson.Util; | ||
import hudson.*; |
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.
Sorry for the aggressive import changes. Alt+Enter on intellij 😄
I can change this back if necessary.
It's been a little over 2 weeks. Is there something I can do to get this reviewed and moving along? |
I so much want this fix.Really waiting to get this to work with windows images on windows boxes. |
@rbutcher I marked the issue as in progress here JENKINS-36776 |
It's been about a month and a half since this was opened. What needs done to get this reviewed and possibly merged? |
Same question as @rbutcher . I want to use Windows containers. |
I do not think this plugin has a maintainer, and given that every change causes a critical regression, IMO it is best left untouched. (Particularly in this area, since we have no meaningful CI on Windows.) If you want to use Windows server containers in build steps, it is advisable to run Docker commands directly. You do not need any special plugin to do so. |
I think that (as you have a CI and testing process on Linux to ensure nothing gets broken on Linux) its not the right way to break the CI usabilaty or such a large Audience. We were waiting for this for month and missing out this feature is preventing us from using Jenkins, because Docker (or Containers in general) is the only accaptable way for us to have a bundled, recreateable Environment in which we can repeat our CI Process. And since we are required to use Windows only tools, switching to Linux is not an option.
IMHO I think, that it's correct to say, that we shouldn't break Linux features to introduce Windows ones. But if I'm correct, it should be possible to test the Linux environment to be unchanged and as Windows currently doesn't have this feature, it's impossible to break it. It might create some new Bugreports, but IMO it's worse to just "ignore" the existing ones to preserve the stability of a feature for a platform it's not available for.
Is there a way to run a Jenkins Plugin inside the container of which I don't know? Because transforming each container to a Jenkins Node creates way to much overhead and running the commands as "docker exec" / "docker run" isn't really usable. I know, that my answer might seem a little harsh, but I think that theres nothing to break for the Windows CI world and that the gain would be massive, while the risk for Linux would be miniscule. I hope someone will find the time and gives Jenkins and Docker for Windows some love and merges this (or a compareable) pull and maybe even to become a maintainer for this plugin. |
@rbutcher we tested your branch and found that the method for whoAmI did not work because it is calling |
You are totally right. When I setup my build machines I put the git I am going to push an override to the whoAmI function that will do the same thing, but without relying on Another thing to note, if your Jenkins workspace is on a drive other than C:\ you will run into container start issues too. For example, we have a I am thinking to resolve this I would just replace Finally, I am planning on maintaining the fork since this does not seem likely to progress. I will leave it open in case @jglick changes his mind. |
Tbh on windows you can skip the user parameter so I would rather have it as a noop. |
@Casz Thanks for being active on this PR. For now I think skipping will be an okay solution to get Docker on Windows rolling, but someone should look into this in the future if this doesn't get solved in this PR. |
If you had to use it you go: docker run -u ContainerUser or docker run -u ContainerAdministrator
I rarely know of any windows image that create users beside using the existing. In this scenario I think the option should be given inside the |
I am aware of this. For the Windows containers we are getting ready to run in production we do create non- I am however looking for insight into how to handle the path mappings from any other drive to C:. I just don't know how common it is for non- |
@rbutcher what I would do is just replace M: to C: and then when launcher is inside a docker container use ws() function to switch workspace. We used this to shorten path because of compiler limitation and hardware limited us to one executor anyway. So I don't have access to the source code any longer But from memory
Work flawlessly I guess the same would work for bind mount in docker. |
@Casz would you be willing to comment on whether there is any chance you will help get this PR through the pipeline and merged? |
I have plenty of work to do and we are waiting for 1809 and new dotnet SDK docker image to do any serious work on windows 😅 |
Subjective I guess, but: #105 The ideal outcome from my PoV:
But for that I need some commitment from @abayer, @ndeloof, and probably @bitwiseman etc. |
Is there any chance this PR will actually be merged? |
What is the current status of this pull request? |
I have a working branch, and we are using it with great success. Though for the work to be truly done it would require Windows agent with Docker on Jenkins CI. |
@dpn982 |
@Casz |
🎯 focused on JCasC atm 😓 |
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.
#148 (comment): I think it is unwise to make any but the most trivial changes to this plugin until the scary and misconceived parts are officially marked experimental and removed from standard guidelines.
@@ -75,6 +75,12 @@ class Docker implements Serializable { | |||
new Image(this, id) | |||
} | |||
|
|||
String shell() { | |||
node { |
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.
Can be deleted.
@@ -93,7 +99,7 @@ class Docker implements Serializable { | |||
def commandLine = "docker build -t ${image} ${args}" | |||
def buildArgs = DockerUtils.parseBuildArgs(commandLine) | |||
|
|||
script.sh commandLine | |||
script."${shell()}" commandLine |
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.
More simply:
script."${shell()}" commandLine | |
script[shell()] commandLine |
@jglick If the general plan is to not make further changes to this plugin that needs to be communicated clearly at the top level of this project and there needs to be a person or group driving the effort to migrate to the new plugin. In the absence of that, not changing this plugin doesn't seem like an option. People will continue to submit PRs for this plugin and there needs to be a path forward for them. What if anything can be done to make changes less risky? |
Well, not so much, since that seems to have been abandoned. See jenkinsci/docker-plugin#681 (comment) for discussion.
Yes and yes! |
Sorry, but this is so frustrating! We worked two weeks to migrate from our old CI to Jenkins and now we've stumbled across this issue. First, we started running Linux builds (with Docker) and Windows builds (without Docker). Then we updated Windows (to Windows Server 2019) to use Docker. And now this! Why is there no warning anywhere that this plugin is dead? Is there any easy-to-use and maintenable workaround or alternative? |
@sboehmann even though I did not test this yet: Adding a kubernetes Windows Node Using kubernetes with jenkins works fine and even better when you deploy your jenkins in the cluster itself. But be aware that setting up a kubernetes cluster is harder than a docker swarm. |
@Snapstromegon That might work. But it's way too much for us. We build C/C++ software and just wanted to use Jenkins/Docker to have a clean build environment and a simpler setup of the build machines. For Linux this works very well, but Windows is just as important. Therefore Jenkins doesn't seem to be a good choice for us. It was an experiment and unfortunately it failed. We will investigate another CI. |
@sboehmann what my company did was just wrote some powershell scripts to emulate what Jenkins does for Linux. This plugin makes working with containers very easy, but for windows you can still execute the same Docker commands. You just need to write it yourself. As long as you use some shared Jenkins scripts, it isn’t too bad. Just a handful of commands. |
@jjathman Yes, we already have a shared library. We already build 50+ repositories - practically always in the same way. So our entire pipeline script is in a shared library. I'll try your suggestion. But would you be so kind to share your shell script? Or could you give some more hints on how to write such a script? Sorry, but I'm really new to the Windows/Docker universe (I'm more the Unix guy). And it would probably also help others who run into this issue. |
I understand your frustration, we had to solve it as well. That said, we're sticking with Jenkins for now. Here's how to run Docker builds on Windows 2016/2019. Edit: I replaced the code with a link to Stackoverflow where I posted the answer. |
@gyorgynadaban looks very interesting! thanks for sharing! Can you please explain what is the Is this kind of Jenkinsfile considered a |
@gyorgynadaban Thank you very much. I was really frustrated, sorry for that. However, I still have one (last?) problem. How can I pull the image from my private registry. Or especially, how can I get the already configured registry (configured for docker-workflow-plugin)? |
@rgl : I think this is considered a scripted pipeline.
Function explanations: Eg. if you create directories like this in the workspace: Then in your
|
@sboehmann : No worries, I was as frustrated as well before I had the solution worked out, I'm glad I could help. :) As for image registry, you'd need to do 2 things:
Your registry would be configured in {
"registry-mirrors": [ "https://docker-dev.myserver.net" ],
"hosts": [ "tcp://0.0.0.0:2376", "npipe://" ]
} The authentication step depends on whether your registry requires authentication to get or publish images, and it depends on your individual setup. |
@gyorgynadaban I see... so those are your custom functions! are you putting them in a shared library like described at https://jenkins.io/doc/book/pipeline/shared-libraries/? or can they also go somewhere in the workspace? |
@rgl : Yes, those are shared libraries. I found it most practical to have a repository with the shared libraries that are loaded implicitly in the Jenkins job. |
@Casz can you share your working branch, or even a built version, so that some of us who are somewhat desperate could deploy it locally to our dev environments and provide feedback sooner rather than later? |
I'll try and get around to it tomorrow. |
Hi @Casz -- I just wanted to check in here. This is a really exciting feature! |
- Fixing haphazard changes to Docker.groovy - Fixing FindBugs issue with annotations on WindowsDockerClient.launch()
Hi guys, is there any update about the potential merge of this feature ? |
here is my updated branch: #184 |
There are two existing pull requests trying to fix the problem of support for Windows slaves. This issue is described in JENKINS-36776, JENKINS-48518, JENKINS-51443, and JENKINS-52120.
PR-98 is more that a year old and is mostly the same changes as are in this PR.
PR-117 is a slimmer change that does not completely address Windows slave support.
While this is a duplicate of some of the other work already done I am opening this PR primarily to bring attention to this deficiency and the fact that this change is highly desired by the Windows developer community.