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

catchError should set result to STABLE if otherwise null

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Minor Minor
    • Jenkins 2.14 running in docker container
      Mailer plugin 1.17
      Pipeline: API 2.1

      Mailer doesn't send "back to normal" email, when pipeline gets green after failed build.
      The "failed build" email is send properly.

      The issue occurs only if plugin is used inside pipeline script.

      Example to reproduce:

      node {
          catchError {
            stage "random fail"
            Random random = new Random();
            int randomNumber = random.nextInt(10 - 1) + 1;
            echo "${randomNumber}"
            if (randomNumber > 5) {
              echo "in loop"
              currentBuild.result = 'FAILURE'
              error "failed"
            }
          }
          echo "after finally"
          step([$class: 'Mailer', recipients: 'tomasz.pietrek@sap.com'])    
      }
      

      The same issue occurs if code is wrapped with try, catch, finally instead of catchError

            Unassigned Unassigned
            tomaszpietrek Tomasz Pietrek
            Votes:
            5 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: