Add support for Jenkins in Docker with non-backward-compatible cgroup v2, such as in Docker Desktop on Mac.#276
Add support for Jenkins in Docker with non-backward-compatible cgroup v2, such as in Docker Desktop on Mac.#276roncemer wants to merge 5 commits intojenkinsci:masterfrom roncemer:master
Conversation
… v2, such as in Docker Desktop on Mac.
|
Possible duplicate of #241?
FYI passing builds produce an Incrementals link. I am not a maintainer. I am not sure if this plugin even has one. My standing advice is to not use it; instead run |
|
My PR doesn't require passing an environment variable, so it doesn't
require any changes to the pipelines when migrating from cgroup v1 to v2.
…On Wed, Sep 28, 2022, 3:33 PM Jesse Glick ***@***.***> wrote:
Possible duplicate of #241
<#241>?
Please merge and issue a new release ASAP
FYI passing builds produce an *Incrementals* link.
—
Reply to this email directly, view it on GitHub
<#276 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABMJUQTW53X37ROYTVJS3M3WASTSJANCNFSM6AAAAAAQYCRO5A>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
|
@car-roll , @dwnusbaum , @rsandell , can someone take a look at this? This fix is pretty urgent, and is definitely worth pushing an update out to the public repo so that Jenkins users can easily get the fix. |
|
@roncemer What makes this urgent? #241 was opened in September. Did something change for all users recently? And who exactly is affected? Only users running Jenkins itself using Docker? For now, there is an incremental build of the plugin based on your PR here (click on the green checkmark next to your latest commit and then follow the link to the Incrementals check) which you (and anyone else) can run. In general there is no one actively maintaining this plugin, especially the I think we are long past overdue updating this plugin to officially discourage direct use of the |
dwnusbaum
left a comment
There was a problem hiding this comment.
I do not really know anything about the underlying Docker issue, but I took a quick look and made some suggestions.
src/main/java/org/jenkinsci/plugins/docker/workflow/client/DockerClient.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jenkinsci/plugins/docker/workflow/client/DockerClient.java
Outdated
Show resolved
Hide resolved
…kerClient.java Co-authored-by: Devin Nusbaum <dwnusbaum@users.noreply.github.com>
…kerClient.java Co-authored-by: Devin Nusbaum <dwnusbaum@users.noreply.github.com>
|
@dwnusbaum Thanks for the suggestions! I committed your suggested changes, rebuilt the plugin, and tested. It still works great. |
|
I would add that compared to running docker commands in sh in a Jenkins pipeline, this plugin is super-convenient, because it handles all of the Jenkins-inside-Docker logic for you. Because of that, I really think it still has value. Without it, if you had a scenario where you wanted to run the same Jenkins pipeline in both Jenkins running under Docker and Jenkins running directly on metal or a virtual machine, each Jenkins pipeline would need to have logic to figure out how to mount the jenkins_home folder under the target Docker container to do the build. This plugin takes care of that for you, and turns all of that into a one-liner. I think it's a pretty slick plugin. If you guys want me to take over maintaining it, I'd be happy to do that. I'm no stranger to that kind of thing. I'm just a little rusty with Java code (used to be a Java expert, but it's been 15 years since I used Java in earnest, and a lot of new language features have been added since then). I recently took over this project, as it was abandoned: https://github.com/roncemer/spark-sql-kinesis and am approved by Sonotype to deploy Maven artifacts. With a little coaching, I could learn how to deploy a Jenkins plugin, and would be happy to take this one over and address any or all of the outstanding issues and pull requests. I would just need to have the permissions on this repo, or I could have GitHub unlink the link between my fork and the original, and you guys could mark the original as abandoned in favor of my repo. Let me know if that's something you're interested in doing. |
|
Hi, I am the author of #241. |
|
Ok, so it appears that no one wants to maintain this plugin except for me. I'll have GitHub unlink my fork from this repository, and release an independent version of this plugin with my fixes. The new official, and actually maintained, repository will be here: https://github.com/roncemer/docker-pipeline-plugin |
|
Please do not fork Jenkins plugins to other orgs. Discussions are under way about who could take responsibility for merging this and tracking any reported regressions. If you would like to offer to maintain this plugin going forward, please see https://www.jenkins.io/doc/developer/plugin-governance/adopt-a-plugin/ |
|
I decided not to use this plugin, nor to take on maintaining it myself. Out of courtesy for people who might stumble upon this plugin and try to use it, as I did, please unpublish it so that it doesn't show up in the list of available plugins in Jenkins. I lost a lot of man-hours on this one. At this point, just wondering where I should send the bill for my wasted time. Also, I don't want to join an exclusive country club just to get my fixes into an open source project. As far as my PR goes, use it, don't use it, I don't care. But that forked repo in my GitHub account isn't going to live there indefinitely. So get while the getting is good...or don't. I must add that the gross negligence in not properly and timely dealing with this and other PRs, from genuinely concerned users, is a black eye on the reputation of Jenkins and the team who are maintaining it. The "it's not urgent" excuse betrays a lackadaisical approach to managing this project. The time spent making lame excuses could have been spent merging the PR and releasing a new version, saving potentially many man-hours for people who stumble upon this plugin and end up trying to use it. Shameful. |
|
We are deploying a gitlab+jenkins server in the company I work for. We are facing this same problem and I would like this or the other pull request to be merged so we can use jenkins with cgroup v2. |
This plugin is written specifically around cgroup v1 which is deprecated / obsolete. The result is that with cgroup v2, it fails to detect that Jenkins is running inside a container, so the /var/jenkins_home directory doesn't get mounted correctly inside the target docker container during the build step, and the commands running inside the target docker container fail and the build hangs and eventually times out.
The fix is to look for a /.dockerenv file, and if it exists, attempt to read Jenkins' container Id from /etc/hosts, matching it with a regex, and then if it matches the pattern of a Docker container Id, using the listProcess() function to list the processes running inside Jenkins' docker container, and if empty, assume that we have a valid container Id, and use it.
This fix works properly with Docker Desktop on Mac, and should work pretty much everywhere else Jenkins is run inside a Docker container.
It still tries cgroup v1 first, and only falls back to /.dockerenv and /etc/hosts if cgroup v1 fails to determine Jenkins' container Id.
Please merge and issue a new release ASAP, as I have a project which is dependent upon this plugin, and I need it working correctly when Jenkins is running under Docker.
Thanks!
Ron Cemer