From 4688148f39919f7eac9e6c6b7661c89a6780a1e8 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Thu, 7 Mar 2024 15:20:27 -0500 Subject: [PATCH] `Job.fastUpdateNextBuildNumber` --- core/src/main/java/hudson/model/Job.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/core/src/main/java/hudson/model/Job.java b/core/src/main/java/hudson/model/Job.java index ab32752704be..8c4e3183100a 100644 --- a/core/src/main/java/hudson/model/Job.java +++ b/core/src/main/java/hudson/model/Job.java @@ -115,6 +115,7 @@ import org.jfree.ui.RectangleInsets; import org.jvnet.localizer.Localizable; import org.kohsuke.accmod.Restricted; +import org.kohsuke.accmod.restrictions.Beta; import org.kohsuke.accmod.restrictions.DoNotUse; import org.kohsuke.accmod.restrictions.NoExternalUse; import org.kohsuke.args4j.Argument; @@ -426,6 +427,16 @@ public synchronized void updateNextBuildNumber(int next) throws IOException { } } + /** + * Unconditionally sets the value of {@link #getNextBuildNumber}. + * Unlike {@link #updateNextBuildNumber} this does not save the number on disk, + * and does not check {@link #getLastBuild}. + */ + @Restricted(Beta.class) + public void fastUpdateNextBuildNumber(int nextBuildNumber) { + this.nextBuildNumber = nextBuildNumber; + } + /** * Returns the configured build discarder for this job, via {@link BuildDiscarderProperty}, or null if none. */