Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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