-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Major
-
Component/s: pipeline, pipeline-stage-step-plugin
-
Environment:Jenkins 2.361.2
Pipeline 590.v6a_d052e5a_a_b_5
Pipeline: Declarative
Version2.2118.v31fd5b_9944b_5
Pipeline: Stage Step
Version296.v5f6908f017a_5
When a stage's result is "unstable" (or worse), it will affect the post-condition's evaluation of all future stages.
If Stage A is unstable and Stage B is successful but has a post condition "Unstable", it will still be executed, because stage A was unstable. The stage-level post condition should only check for the stage's result.
Reproduce with the below pipeline:
pipeline {
  agent any
  stages {
    stage('Set to unstable') {
      steps {
        unstable("This sets unstable")
      }
    }
    stage('Successful stage') { //This stage is successful
      steps {
        echo 'Deploying....'
      }
      post {
        success {
          echo "Post Success" // Will not run
        }
        unstable {
          echo "Post Unstable" // Will run
        }
      }
    }
  }
}
Â