-
Bug
-
Resolution: Fixed
-
Minor
-
Jenkins v2.121.1, Pipeline: Declarative Plugin v1.3
The Jenkins Declarative Pipeline is experiencing non-deterministic results when entering the post steps for parallel stages. For example, when an error is raised in one of two parallel stages and the other stage succeeds, but finish around the same time, then the successful stage executes the failure post stage, instead of the successful.
stage("Parallel stages") { parallel { stage("Stage 1"){ agent none steps { script { // sleep 10 // when sleeping long enough, stages behave correctly. error("Which post step will get executed?") } } post { success { echo "Stage 1 success!" } failure { echo "Stage 1 failure!" } } } stage("Stage 2"){ agent none steps { script { echo "Stage 2 code executing..." } } post { success { echo "Stage 2 success!" } failure { echo "Stage 2 failure!" } } } } post { success { echo "Parallel post steps success!" } failure { echo "Parallel post steps failure!" } } }
So when Stage 1 has the sleep step commented out the results I see are:
[Stage 1] Stage 1 failure!
[Stage 2] Stage 2 failure!
Parallel post steps failure!
But when Stage 1 has the sleep step active, the results I see are:
[Stage 1] Stage 1 failure!
[Stage 2] Stage 2 success!
Parallel post steps failure!
I should expect the second scenario in all situations, right?
- links to