Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-69963

Stage result has effect on future stage's post behaviour

XMLWordPrintable

      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
                      }
                  }
              }
          }
      }
      

       

            Unassigned Unassigned
            meiswjn Jan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: