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

Post steps in parallel parent are executed after previous stage failure

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • OS: Ubuntu 14.04
      Jenkins: 2.67
      pipeline-model-definition-plugin 1.2.4

      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
      

            abayer Andrew Bayer
            tad Tad Fisher
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: