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

Add script to mark build agents offline for shutdown. #1006

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

nuclearsandwich
Copy link
Contributor

Because of the way import package jobs are triggered by package build jobs the normal Jenkins shutdown procedures will block triggering the import package jobs required to complete a packaging job, preventing jobs from finishing (until they fail due to timeout).

The added script can be used to mark build agents offline in order to drain running packaging jobs while allowing the repo host to continue importing packages to let jobs finish.

Because of the way import package jobs are triggered by package build
jobs the normal Jenkins shutdown procedures will block triggering the
import package jobs required to complete a packaging job, preventing
jobs from finishing (until they fail due to timeout).

The added script can be used to mark build agents offline in order to
drain running packaging jobs while allowing the repo host to continue
importing packages to let jobs finish.
@nuclearsandwich nuclearsandwich requested a review from cottsay June 23, 2023 15:09
@nuclearsandwich nuclearsandwich self-assigned this Jun 23, 2023
Copy link
Member

@cottsay cottsay left a comment

Choose a reason for hiding this comment

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

One suggestion, but overall LGTM.

Comment on lines +89 to +92
import hudson.model.labels.LabelAtom
import hudson.slaves.OfflineCause.UserCause

cause = new UserCause(Jenkins.get().getUser("nuclearsandwich"), "Allow package imports to catch up")
Copy link
Member

Choose a reason for hiding this comment

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

Can we use User.current() here instead?

Suggested change
import hudson.model.labels.LabelAtom
import hudson.slaves.OfflineCause.UserCause
cause = new UserCause(Jenkins.get().getUser("nuclearsandwich"), "Allow package imports to catch up")
import hudson.model.labels.LabelAtom
import hudson.model.User
import hudson.slaves.OfflineCause.UserCause
cause = new UserCause(User.current(), "Allow package imports to catch up")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants