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

stages with children always marked as success

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • pipeline
    • None

      If you have a stage which children it will always be reported as successful.

      stage('Parent') {
          echo "Parent starting..."
          stage('Child 1') {
              echo 'Child 1'
              catchError(stageResult: FAILURE') {
                  throw new Exception('Child 1 error')
              }
          }
          echo "Parent after child 1..."
          catchError(stageResult: FAILURE') {
              throw new Exception('Parent error')
          }
      } 

       

      In this example both 'Parent' and 'Child 1' stages should be marked as failed but instead 'Child 1' is correct marked as failed but 'Parent' is marked as successful.

       

      stage('Parent') {
         echo "Parent starting..."
         catchError(stageResult: FAILURE') {
              throw new Exception('Parent error')
         }
      }

      This example proves that the second catch error in the first example is capable of setting the 'Parent' to failure, it just doesn't do it if a child stage exists.

            Unassigned Unassigned
            steveh Steven
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: