-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
Tested with:
* Jenkins 2.32.3 and 2.37
* Pipeline: Stage Step: 2.2
Aborting the build manually or via an input step results in state Failed instead of state Aborted. This creates a misleading visualization of the project, where users will be lead to believe the project is unstable.
Steps to reproduce
Use the following Jenkinsfile
node {
stage ('Sleep') { sleep 60 }
}
Start a build and abort it while it's sleeping. The job output:
Sleeping for 1 min 0 sec Aborted by user GitHub has been notified of this commit’s build result Finished: ABORTED
While the status is logged as Aborted, the job is shown as Failed:
Workaround
Use the old stage syntax instead of the new block syntax:
node {
stage 'Sleep'
sleep 60
}
Aborting this job while sleeping yields the following log:
Using the ‘stage’ step without a block argument is deprecated Entering stage Sleep Proceeding Sleeping for 1 min 0 sec Aborted by user GitHub has been notified of this commit’s build result Finished: ABORTED
This time the job status is correctly shown as Aborted:
Why this is important
1. It erodes user confidence in projects that are erroneously marked as Failed
2. It encourages users to write Jenkinsfiles using the legacy Stage syntax
Workaround is to catch FlowInterruptedException and set currentBuild.result = 'SUCCESS'
I would prefer to not do this.