-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
Job.BuildNumberAssigner
#9846
Job.BuildNumberAssigner
#9846
Conversation
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.
LGTM
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.
/label ready-for-merge
This PR is now ready for merge, after ~24 hours, we will merge it if there's no negative feedback.
Thanks!
Plugin BOM reports a test failure in the jacoco plugin when testing weekly with Jenkins 2.484. |
In CloudBees CI in high availability mode, the default behavior of
Job.assignBuildNumber
(updating a counter in memory, and writing it to disk) is not suitable for rapid build triggers of a single job; an external counter is needed at least transiently (thenextBuildNumber
file is fine for a durable count). This beta extension point allows a plugin to swap in an alternate strategy for maintaining the next build number.TheReworked, I hope more clearly.BuildNumberAssignment
return type is a bit awkward but I could not think of a better API.Job.saveNextBuildNumber
isprotected
, so not usable from alternate implementations, and I did not want to make itpublic
solely for the benefit of a beta API. (Introducing apublic
alias also seemed weird.) The method introduced in #9019 does not save, whereas the olderupdateNextBuildNumber
method remains undesirable here because of its call togetLastBuild
. Automatically callingsaveNextBuildNumber
fromassignBuildNumber
would change sychronization behavior for the default implementation, and makingassignBuildNumber
besynchronized
would be undesirable for the CloudBees CI implementation.This PR makes #9778 not strictly necessary but I think it remains appropriate anyway.
Testing done
Effectiveness confirmed by a functional test in CloudBees CI.
Proposed changelog entries
Before the changes are marked as
ready-for-merge
:Maintainer checklist