-
Type:
Bug
-
Status: Resolved (View Workflow)
-
Priority:
Minor
-
Resolution: Fixed
-
Component/s: pipeline-model-definition-plugin
-
Labels:None
-
Environment:OS: Ubuntu 14.04
Jenkins: 2.67
pipeline-model-definition-plugin 1.2.4
-
Similar Issues:
When a pipeline stage fails, subsequent stages execute their "failure" post steps even if they are skipped. This only occurs for stages which host parallel child stages.
Example:
pipeline { agent none stages { stage('One') { agent any steps { error('fail') } post { failure { echo 'One' } } stage('Two') { agent any steps { echo "Shouldn't run" } post { failure { echo 'Two' } } } stage('Three') { parallel { stage('Child 1') { agent any steps { echo 'Child 1' } } stage('Child 2') { agent any steps { echo 'Chlid 2' } } } post { failure { echo 'Three' } } } } }
This will echo:
One Three
Code changed in jenkins
User: Andrew Bayer
Path:
pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy
pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/PostStageTest.java
pipeline-model-definition/src/test/resources/postStage/postAfterParallel.groovy
http://jenkins-ci.org/commit/pipeline-model-definition-plugin/8e18c3506e63e9ee06d8f5f69c26649d6b8ae3f6
Log:
[FIXED JENKINS-48266] Skip post for skipped parallel stages
The
JENKINS-47928fix was actually not right - it disabled callingpost entirely for parallel parent stages if they weren't the source of
an error themselves. That means they weren't called at all if there
was no failure!
The proper fix is to track whether a parallel parent stage has been
skipped, and if so, skip post execution as well. Which is what's done
here. Tada.