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

catchError does not mark a stage as failed

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • pipeline-model-definition-plugin 1.3.2+

      This may be a case outlined by the release notes for JENKINS-52114 but definitely caught me by surprise. Since catchError still marks the build as failed (as expected), I would expect the stage to be considered failed as well.

       

      pipeline {
        agent none
        options { skipDefaultCheckout() }
        stages {
          stage('catchError') {
            steps {
              catchError {
                error 'Force error'
              }
              echo 'This echo still runs'
            }   
            post {
              success { echo 'Post success will still run' }
              failure { echo 'I will not run!' }
            }   
          }   
        }
      } 

      I suspect this is a root cause for JENKINS-52005 as well.

            Unassigned Unassigned
            rpocase Robby Pocase
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: