jenkinsci / jenkinsci/workflow-cps-plugin
[JENKINS-66456] Interrupting parallel stage with success status aborts the build with aborted status
- Dominant language
- Java
- Stars
- 186
- Forks
- 213
- Avg merge
- 12h 12m
- Merged PRs (30d)
- 8
Description
Hello,
When running the following pipeline...
pipeline {
agent none
stages {
stage('Test') {
parallel {
stage('Fast stage') {
steps {
echo 'Done already'
}
}
stage('Slow stage') {
steps {
echo 'Please interrupt now!'
sleep 600
}
}
}
}
}
}
... and interrupting the build programmatically with a success status while the "Slow stage" is still in progress, e.g. with the following snippet in Jenkins' script console...
def build = Jenkins.instance.getItemByFullName('path/to/the/job').lastBuild
def cause = new org.jenkinsci.plugins.pipeline.milestone.CancelledCause('testing')
def executor = build.executor
executor?.interrupt(hudson.model.Result.SUCCESS, cause)
... the build is aborted but its status is set to aborted instead of success.
This behavior could be related to JENKINS-31953.
---
Originally reported by agauthiez, imported from: Interrupting parallel stage with success status aborts the build with aborted status
Raw content of original issue
Hello,
When running the following pipeline...
pipeline {
agent none
stages {
stage('Test') {
parallel {
stage('Fast stage') {
steps {
echo 'Done already'
}
}
stage('Slow stage') {
steps {
echo 'Please interrupt now!'
sleep 600
}
}
}
}
}
}... and interrupting the build programmatically with a success status while the "Slow stage" is still in progress, e.g. with the following snippet in Jenkins' script console...
def build = Jenkins.instance.getItemByFullName('path/to/the/job').lastBuild
def cause = new org.jenkinsci.plugins.pipeline.milestone.CancelledCause('testing')
def executor = build.executor
executor?.interrupt(hudson.model.Result.SUCCESS, cause)... the build is aborted but its status is set to aborted instead of success.
This behavior could be related to JENKINS-31953.
Contributor guide
Research direction
Reproduce the pipeline with the fast and slow parallel stages, then use the Jenkins script console interruption shown in the issue as the entry point. Trace the workflow-cps-plugin handling of the interruption and compare the recorded result with the requested SUCCESS status. Done means an interrupted parallel build records SUCCESS rather than ABORTED.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- groovy, java
- Domain
- ci-cd
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100