From 053d79925f67e7a17dc0c45d2907f5bc0112031a Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Wed, 9 Oct 2024 07:46:47 -0700 Subject: [PATCH 1/2] Require Java 17 or newer; migrate to EE 9 (#271) --- pom.xml | 8 ++++---- .../plugins/throttleconcurrents/ThrottleJobProperty.java | 4 ++-- .../ThrottleJobPropertyPipelineTest.java | 2 +- .../plugins/throttleconcurrents/ThrottleStepTest.java | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pom.xml b/pom.xml index aa80ca11..9b28a572 100644 --- a/pom.xml +++ b/pom.xml @@ -27,7 +27,7 @@ THE SOFTWARE. org.jenkins-ci.plugins plugin - 4.88 + 5.1 @@ -84,7 +84,7 @@ THE SOFTWARE. 2.15 -SNAPSHOT - 2.387.3 + 2.479 jenkinsci/throttle-concurrent-builds-plugin false @@ -93,8 +93,8 @@ THE SOFTWARE. io.jenkins.tools.bom - bom-2.387.x - 2543.vfb_1a_5fb_9496d + bom-2.462.x + 3435.v238d66a_043fb_ pom import diff --git a/src/main/java/hudson/plugins/throttleconcurrents/ThrottleJobProperty.java b/src/main/java/hudson/plugins/throttleconcurrents/ThrottleJobProperty.java index b5777353..a6aec24f 100644 --- a/src/main/java/hudson/plugins/throttleconcurrents/ThrottleJobProperty.java +++ b/src/main/java/hudson/plugins/throttleconcurrents/ThrottleJobProperty.java @@ -48,7 +48,7 @@ import org.kohsuke.stapler.AncestorInPath; import org.kohsuke.stapler.DataBoundConstructor; import org.kohsuke.stapler.QueryParameter; -import org.kohsuke.stapler.StaplerRequest; +import org.kohsuke.stapler.StaplerRequest2; public class ThrottleJobProperty extends JobProperty> { // Replaced by categories, to support, well, multiple categories per job (starting from 1.3) @@ -423,7 +423,7 @@ public boolean isMatrixProject(Job job) { } @Override - public boolean configure(StaplerRequest req, JSONObject formData) throws FormException { + public boolean configure(StaplerRequest2 req, JSONObject formData) throws FormException { if (!formData.has("categories")) { this.categories = null; } diff --git a/src/test/java/hudson/plugins/throttleconcurrents/ThrottleJobPropertyPipelineTest.java b/src/test/java/hudson/plugins/throttleconcurrents/ThrottleJobPropertyPipelineTest.java index c731fc03..de50adb7 100644 --- a/src/test/java/hudson/plugins/throttleconcurrents/ThrottleJobPropertyPipelineTest.java +++ b/src/test/java/hudson/plugins/throttleconcurrents/ThrottleJobPropertyPipelineTest.java @@ -252,7 +252,7 @@ public void limitOneJobWithMatchingParams() throws Exception { j.assertBuildStatusSuccess(j.waitForCompletion(secondRun)); } - static CpsFlowDefinition getJobFlow(String jobName, String label) { + static CpsFlowDefinition getJobFlow(String jobName, String label) throws Exception { return new CpsFlowDefinition(getThrottleScript(jobName, label), true); } diff --git a/src/test/java/hudson/plugins/throttleconcurrents/ThrottleStepTest.java b/src/test/java/hudson/plugins/throttleconcurrents/ThrottleStepTest.java index 07cec6d8..1d173372 100644 --- a/src/test/java/hudson/plugins/throttleconcurrents/ThrottleStepTest.java +++ b/src/test/java/hudson/plugins/throttleconcurrents/ThrottleStepTest.java @@ -439,11 +439,11 @@ public void inOptionsBlockOfDeclarativePipeline() throws Exception { j.assertBuildStatusSuccess(j.waitForCompletion(secondJobFirstRun)); } - private CpsFlowDefinition getJobFlow(String jobName, String category, String label) { + private CpsFlowDefinition getJobFlow(String jobName, String category, String label) throws Exception { return getJobFlow(jobName, Collections.singletonList(category), label); } - private CpsFlowDefinition getJobFlow(String jobName, List categories, String label) { + private CpsFlowDefinition getJobFlow(String jobName, List categories, String label) throws Exception { return new CpsFlowDefinition(getThrottleScript(jobName, categories, label), true); } @@ -471,7 +471,7 @@ private String getThrottleScript(String jobName, List categories, String + "}\n"; } - static CpsFlowDefinition getDeclarativeJobFlow(String jobName, String categories, String label) { + static CpsFlowDefinition getDeclarativeJobFlow(String jobName, String categories, String label) throws Exception { return new CpsFlowDefinition( getDeclarativeThrottleScript(jobName, Collections.singletonList(categories), label), true); } From ef682b2a6c3789f5b7d0728f0c0c8c132e974bf8 Mon Sep 17 00:00:00 2001 From: nvsmirnov <50905641+nvsmirnov@users.noreply.github.com> Date: Wed, 9 Oct 2024 19:40:17 +0300 Subject: [PATCH 2/2] [JENKINS-67978] Fix for job parameters on built-in node (#232) --- .../throttleconcurrents/ThrottleQueueTaskDispatcher.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/hudson/plugins/throttleconcurrents/ThrottleQueueTaskDispatcher.java b/src/main/java/hudson/plugins/throttleconcurrents/ThrottleQueueTaskDispatcher.java index 4da52f63..d038170a 100644 --- a/src/main/java/hudson/plugins/throttleconcurrents/ThrottleQueueTaskDispatcher.java +++ b/src/main/java/hudson/plugins/throttleconcurrents/ThrottleQueueTaskDispatcher.java @@ -340,7 +340,7 @@ private boolean isAnotherBuildWithSameParametersRunningOnNode(Node node, Queue.I // whether one of these executing units is an instance // of the queued item we were asked to compare to. if (computer != null) { - for (Executor exec : computer.getExecutors()) { + for (Executor exec : computer.getAllExecutors()) { // TODO: refactor into a nameEquals helper method final Queue.Executable currentExecutable = exec.getCurrentExecutable(); final SubTask parentTask = currentExecutable != null ? currentExecutable.getParent() : null;