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

A failure in post/always should not prevent the post/failure block to be called

    Details

    • Similar Issues:

      Description

      Hey o/ ,

      If there's an error in some step of the post/always {} block, it seems like this will stop the processing of the post sub-steps.
      I put it Critical, but it almost seems like a blocker: this seems a common use case and counter-intuitive, so I hope you'll agree this is not expected/intended.

      Typical case:

      • I want to always generate some reports (junit, say)
      • I want to notify people *only* on failure

      If something goes wrong in always, still the failure notification should go out for instance.

      Reproduction code:

      pipeline {
          
          agent {
              label 'linux'
          }
          
          post {
              always {
                  echo "ALWAYS THE SUN!!!"
                  junit '**/nonexisting_to_make_this_fail/*.xml'
              }
              failure {
                  echo "WE FAILED MISERABLY! I won't be shown because junit step failed above"
              }
          }
          
          stages {
              stage('bim') {
                  steps {
                      sh "echo bonjour"
                      
                      sh "exit 1"
                  }
              }
          }
      }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                abayer Andrew Bayer
                Reporter:
                batmat Baptiste Mathus
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: