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

Finally block with multiple statements shows try block status

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • blueocean-plugin
    • None

      A try / finally which fails in the try block and has more than one finally statement will display the try block's failure with the last statement and show it as failed. 

      This works (see one finally statement.png):

      def jobs = [:]
      ['1', '2'].each { it ->
          jobs[it] = {
              node('master') {
                  try {
                      sh 'exit 1'
                  } finally {
                      echo "Cleanup 1"
                  }
              }
          }
      }
      parallel jobs
      

       

      This does not (see two/three finally statements.png):

      def jobs = [:]
      ['1', '2'].each { it ->
          jobs[it] = {
              node('master') {
                  try {
                      sh 'exit 1'
                  } finally {
                      echo "Cleanup 1"
                      echo "Cleanup 2"
                      // echo "Cleanup 3"
                  }
              }
          }
      }
      parallel jobs
      

          [JENKINS-50049] Finally block with multiple statements shows try block status

          There are no comments yet on this issue.

            Unassigned Unassigned
            externl Joe George
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: