Skip to content

Commit 3805482

Browse files
authored
fix: Make BecauseResourcesTimeout fatal to fix freestyle lock timeout on Jenkins 2.532+ (#1027)
Jenkins 2.532 (core PR #11173) changed Queue.maintain() to create a new BlockedItem instead of updating the existing one when canRun() returns a CauseOfBlockage. This caused the manual Queue.cancel() in checkFreestyleTimeout() to be immediately undone. Override isFatal() returning true on BecauseResourcesTimeout so the queue itself handles the cancellation. Also bump Jenkins baseline to 2.541 (the next LTS line that includes the isFatal() API) and update BOM accordingly. Fixes #1026
1 parent d273202 commit 3805482

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
<properties>
5656
<changelist>999999-SNAPSHOT</changelist>
5757
<!-- https://www.jenkins.io/doc/developer/plugin-development/choosing-jenkins-baseline/ -->
58-
<jenkins.baseline>2.528</jenkins.baseline>
58+
<jenkins.baseline>2.541</jenkins.baseline>
5959
<jenkins.version>${jenkins.baseline}.3</jenkins.version>
6060
<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>
6161
<spotbugs.effort>Max</spotbugs.effort>
@@ -71,7 +71,7 @@
7171
<dependency>
7272
<groupId>io.jenkins.tools.bom</groupId>
7373
<artifactId>bom-${jenkins.baseline}.x</artifactId>
74-
<version>6329.v403d8c87a_5ce</version>
74+
<version>6364.v16b_76a_4023c7</version>
7575
<type>pom</type>
7676
<scope>import</scope>
7777
</dependency>

src/main/java/org/jenkins/plugins/lockableresources/queue/LockableResourcesQueueTaskDispatcher.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,5 +265,15 @@ public String getShortDescription() {
265265
+ timeoutUnit.toLowerCase(java.util.Locale.ENGLISH)
266266
+ " waiting for lockable resources";
267267
}
268+
269+
/**
270+
* Signals that this blockage is fatal and the queue item should be removed.
271+
* Since Jenkins 2.532 (core PR #11173), the queue checks this flag and
272+
* cancels the item itself instead of re-adding it as a {@code BlockedItem}.
273+
*/
274+
@Override
275+
public boolean isFatal() {
276+
return true;
277+
}
268278
}
269279
}

0 commit comments

Comments
 (0)