Skip to content
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

Support --cgroup-parent flag #1056

Merged
merged 2 commits into from
Mar 8, 2024
Merged

Conversation

rrjjvv
Copy link
Contributor

@rrjjvv rrjjvv commented Mar 5, 2024

Resolves #791

This is essentially the same implementation from #792, but adds the requested changes from that PR and other tweaks due to changes in code/links since that time.

Testing done

From my CI environment using this patched plugin...

Configure via groovy:

# cat /opt/jenkins/init.groovy.d/agents.groovy
jenkins = jenkins.model.Jenkins.get()
jenkins.clouds.getByName('LocalCloud').with {
  templates.each { t ->
    t.dockerTemplateBase.cgroupParent = 'jenkins-agents.slice'
  }
}
jenkins.save()

Running agent:

# docker ps --filter label=com.nirima.jenkins.plugins.docker.JenkinsTemplateName --no-trunc -q
57ba50b168d458275826cf364dcb3f8f7c1446dd5eef894fdb8edc19f8e8a528

Verify cgroup hierarchy (v2/systemd):

# find /sys/fs/cgroup/ -name '*57ba50b168d458275826cf364dcb3f8f7c1446dd5eef894fdb8edc19f8e8a528*' -type d
/sys/fs/cgroup/jenkins.slice/jenkins-agents.slice/docker-57ba50b168d458275826cf364dcb3f8f7c1446dd5eef894fdb8edc19f8e8a528.scope
# cat /proc/$(pgrep -f 'java.*remoting' | tail -n1)/cgroup
0::/jenkins.slice/jenkins-agents.slice/docker-57ba50b168d458275826cf364dcb3f8f7c1446dd5eef894fdb8edc19f8e8a528.scope

Submitter checklist

Tasks

@rrjjvv rrjjvv requested a review from a team as a code owner March 5, 2024 01:20
@krisstern krisstern self-assigned this Mar 5, 2024
@krisstern krisstern added the feature a PR providing a new feature. label Mar 5, 2024
@krisstern
Copy link
Member

Code implementation looks consistent do what has been suggested in #792.

Copy link
Member

@krisstern krisstern left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks @rrjjvv

@krisstern krisstern merged commit 032c659 into jenkinsci:master Mar 8, 2024
16 checks passed
@rrjjvv rrjjvv deleted the add-cgroup-parent branch March 8, 2024 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a PR providing a new feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for --cgroup-parent
2 participants