Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
None
Description
Consider the following example:
pipeline { agent { label 'linux' } stages { stage('Successful stage') { steps { script { sh "sleep 15" // intentionally not using sleep 15 step! } } } } post { success { echo "Triggered post-success" } failure { echo "Triggered post-failure" } unstable { echo "Triggered post-unstable" } aborted { echo "Triggered post-aborted" } } }
Start the build, let it go into "sleep" and abort the build. The result will be:
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Declarative: Post Actions)
[Pipeline] echo
Triggered post-aborted
[Pipeline] echo
Triggered post-failure
[Pipeline] }
The result is having both `post-aborted` and `post-failure` executed. What should have happened was to receive only `post-aborted` step.
I've also seen in the logs `post-unstable` and `post-failure`, but I am not sure how to provide a way to reproduce this. I'm not sure how that happened but I have seen it a few times on some of our builds.
Attachments
Issue Links
- links to
Activity
Field | Original Value | New Value |
---|---|---|
Description |
Consider the following example: {code:java} pipeline { agent { label 'linux' } stages { stage('Successful stage') { steps { script { sh "sleep 15" // intentionally not using sleep 15 step! } } } } post { success { echo "Triggered post-success" } failure { echo "Triggered post-failure" } unstable { echo "Triggered post-unstable" } aborted { echo "Triggered post-aborted" } } } {code} Start the build, let it go into "sleep" and abort the build. The result will be: {code:java} [Pipeline] // stage [Pipeline] stage [Pipeline] { (Declarative: Post Actions) [Pipeline] echo Triggered post-aborted [Pipeline] echo Triggered post-failure [Pipeline] } {code} I've also seen in the logs `post-unstable` and `post-failure`, but I am not sure how to provide a way to reproduce this. I'm not sure how that happened but I have seen it a few times on some of our builds. |
Consider the following example: {code:java} pipeline { agent { label 'linux' } stages { stage('Successful stage') { steps { script { sh "sleep 15" // intentionally not using sleep 15 step! } } } } post { success { echo "Triggered post-success" } failure { echo "Triggered post-failure" } unstable { echo "Triggered post-unstable" } aborted { echo "Triggered post-aborted" } } } {code} Start the build, let it go into "sleep" and abort the build. The result will be: {code:java} [Pipeline] // stage [Pipeline] stage [Pipeline] { (Declarative: Post Actions) [Pipeline] echo Triggered post-aborted [Pipeline] echo Triggered post-failure [Pipeline] } {code} The result is having both `post-aborted` and `post-failure` executed. What should have happened was to receive only `post-aborted` step. I've also seen in the logs `post-unstable` and `post-failure`, but I am not sure how to provide a way to reproduce this. I'm not sure how that happened but I have seen it a few times on some of our builds. |
Status | Open [ 1 ] | In Progress [ 3 ] |
Summary | Post stages are incorrectly handled | Aborting a sh or bat step fires both aborted and failure post conditions |
Status | In Progress [ 3 ] | In Review [ 10005 ] |
Remote Link | This issue links to "PR #262 (Web Link)" [ 20407 ] |
Resolution | Fixed [ 1 ] | |
Status | In Review [ 10005 ] | Resolved [ 5 ] |
Status | Resolved [ 5 ] | Closed [ 6 ] |