Skip to content

refactor: resume a paused build when it is aborted - #1819

Open
bianbbc87 wants to merge 1 commit into
jenkinsci:masterfrom
bianbbc87:fix/1818
Open

refactor: resume a paused build when it is aborted#1819
bianbbc87 wants to merge 1 commit into
jenkinsci:masterfrom
bianbbc87:fix/1818

Conversation

@bianbbc87

Copy link
Copy Markdown

Describe PR

CpsFlowExecution.interrupt() delivers a FlowInterruptedException into the CPS threads, but propagating it running catch/finally and ending the program requires CpsThreadGroup.run(), which scheduleRun() skips while paused.

So if the build stayed paused, the abort was delivered but never completed until someone unpaused it manually or used Hard Kill.

This just adds one rule on top aborting a build clears the pause. The pause gate itself is untouched.
Quiet-down pauses and CpsBodyExecution.cancel() (parallel failFast) are out of scope.

Fixes #1818

Testing done

New test CpsFlowExecutionTest.abortWhilePaused pauses a build at semaphore, aborts it, and checks it finishes. Pipeline is try {semaphore 'wait'} finally {echo 'cleaning up'}.

mvn -pl plugin -am test -Dtest=CpsFlowExecutionTest#abortWhilePaused

Before fix

[p #1] Pausing
SemaphoreStep$Execution#stop: Stopping wait/1
[p #1] Click here to forcibly terminate running steps
=> ConditionTimeoutException: build still running after 60s

After fix

[p #1] Pausing
SemaphoreStep$Execution#stop: Stopping wait/1
[p #1] Resuming to process abort
[p #1] cleaning up
[p #1] Finished: ABORTED

Expected result

the abort completes instead of hanging, finally still runs, and the build ends as ABORTED.

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

Signed-off-by: EunJiJung <bianbbc87@gmail.com>
@bianbbc87
bianbbc87 requested a review from a team as a code owner August 9, 2026 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Paused Pipeline builds can never reach a terminal state and agent loss are all blocked by the paused CPS VM

1 participant