Skip to content

Commit

Permalink
[JENKINS-73824] Wait for Pipeline builds to complete before allowing …
Browse files Browse the repository at this point in the history
…their jobs to be deleted (#9790)

* Wait for Pipelines to complete before allowing their jobs to be deleted

* Create mock Job/Run classes that use AsynchronousExecution to be able to add a regression test in core

* [JENKINS-73824] Do not repeatedly interrupt executables in ItemDeletion.cancelBuildsInProgress

* [JENKINS-73824] Delete ItemDeletionTest based on #9790 (comment)

(cherry picked from commit 4d7b993)
  • Loading branch information
dwnusbaum authored and MarkEWaite committed Oct 12, 2024
1 parent 6aee271 commit c2ec435
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions core/src/main/java/jenkins/model/queue/ItemDeletion.java
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,10 @@ public static void cancelBuildsInProgress(@NonNull Item initiatingItem) throws F
// comparison with executor.getCurrentExecutable() == executable currently should always be
// true as we no longer recycle Executors, but safer to future-proof in case we ever
// revisit recycling.
if (!entry.getKey().isAlive()
if (!entry.getKey().isActive()
|| entry.getValue() != entry.getKey().getCurrentExecutable()) {
iterator.remove();
}
// I don't know why, but we have to keep interrupting
entry.getKey().interrupt(Result.ABORTED);
}
Thread.sleep(50L);
}
Expand Down

0 comments on commit c2ec435

Please sign in to comment.