Post steps in parallel parent are executed after previous stage failure

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      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
      

            Assignee:
            Andrew Bayer
            Reporter:
            Tad Fisher
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: