Jenkins: a Pipeline build that will not abort
Stopping a Pipeline build (the red X, or a POST to the build's stop) asks its running steps to stop. That usually ends the build within seconds. A script that catches every exception can keep it going. Until October 2026 the console then offered two links, Click here to forcibly terminate running steps and Click here to forcibly kill entire build. Since Pipeline: Job 1622, Jenkins takes both steps by itself, 15 seconds apart, and the term and kill addresses are gone. Below are real answers from a Jenkins 2.580.1 with the Pipeline plugins, tried on October 30, 2026.
What Stop does
A build running bat 'ping -n 300 127.0.0.1', stopped with one POST:
Sending interrupt signal to process
Aborted by tester
Stage "After" skipped due to earlier failure(s)
[Pipeline] { (Declarative: Post Actions)
post always ran
Finished: ABORTED
- It ended about 6 seconds after the POST. The running step's process got the interrupt, the later stages were skipped, and
post { always { … } }ran. - A build still waiting for an executor ("Waiting for next available executor") ended at once, ABORTED, with no stage run.
- Stopping needs the Job/Cancel permission on the job (
checkAbortPermissionin Jenkins's source).
Jenkins forcibly terminates, then kills (since October 2026)
A script that catches every exception keeps running after Stop, because the step's interruption is an exception too:
script {
for (int i = 0; i < 900; i++) {
try {
sleep time: 1, unit: 'SECONDS'
} catch (e) {
echo "caught: ${e}"
}
}
}
One POST to stop, and nothing more:
0.6 s Aborted by tester 0.6 s caught: org.jenkinsci.plugins.workflow.steps.FlowInterruptedException: Aborted by tester 15.2 s Forcibly terminating running steps 15.2 s Terminating sleep 15.2 s caught: org.jenkinsci.plugins.workflow.steps.FlowInterruptedException: 30.4 s Forcibly killing entire build 30.4 s Finished: ABORTED
- This is workflow-job-plugin #804, released in Pipeline: Job 1622.vc41c189cb_e5f on October 26, 2026: 15 seconds after an abort Jenkins terminates the running steps, and 15 seconds later it kills the build, "just as if the links were clicked as soon as they appeared".
- The kill ends the build without running any more steps or Groovy statements, so
postsections andfinallyblocks that had not run yet do not run. - The two waits are the system properties
org.jenkinsci.plugins.workflow.job.WorkflowRun.termGracePeriodand…killGracePeriod(15s each); the pull request calls them unsupported, for emergencies.
Where the /term and /kill links went
Before Pipeline: Job 1622, the console printed "Click here to forcibly terminate running steps" 15 seconds after an abort that did not end the build, and "Click here to forcibly kill entire build" 15 seconds after that. The links sent a POST to the build's term and kill addresses, and the build's side panel offered the same. Since 1622 neither address exists:
curl -X POST -u '<user>:<API token>' https://jenkins.example.com/job/<job>/<number>/term HTTP 404 curl -X POST -u '<user>:<API token>' https://jenkins.example.com/job/<job>/<number>/kill HTTP 404
Answers that tell you to open …/term or …/kill are about the older versions. To see yours: Manage Jenkins > Plugins > Installed plugins > Pipeline: Job. On 1622 or later, stop once and wait about 30 seconds.
Make the script stop at once
Let the interruption through: catch FlowInterruptedException first and throw it again.
try {
sleep time: 1, unit: 'SECONDS'
} catch (org.jenkinsci.plugins.workflow.steps.FlowInterruptedException e) {
throw e
} catch (e) {
echo "caught: ${e}"
}
In the Groovy sandbox this ran without a script approval, and the same Stop ended the build in 0.6 seconds (Aborted by tester, Finished: ABORTED). The retry step already knows to give up on a real interruption.
Stop a build with curl
curl -X POST -u '<user>:<API token>' https://jenkins.example.com/job/<job>/<number>/stop HTTP 200
- It has to be a POST: a GET answered HTTP 405.
- With an API token no CSRF crumb was asked for. The same POST without signing in answered HTTP 403 "No valid crumb was included in the request".
stopis the only address for this on Pipeline: Job 1622 and later; the escalation starts from it.
Stop builds from IntelliJ IDEA
Pipeline Inbox for Jenkins, a plugin by Lesstep for JetBrains IDEs 2024.1 or later, lists the builds of the jobs you choose, with stages, failed tests and console logs. Its Stop Build asks first, then sends the same POST to stop as the red X, and reads the build again. On Pipeline: Job 1622 or later, Jenkins then ends a build that ignores it by itself; on an older one, use the links in the build's console on Jenkins. The build list, stages and console logs are free; building, stopping builds and answering input steps are Pro (US$1.50 a month, with a 30-day trial).
Jenkins® is a registered trademark of LF Charities Inc.; IntelliJ IDEA is a trademark of JetBrains s.r.o. This page is not affiliated with or endorsed by the Jenkins project or JetBrains.
More: Proceed or Abort a build that waits for input · "Waiting for next available executor" · Jenkins plugins for IntelliJ IDEA compared · 日本語