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

JUnit failures do not trigger unstable post steps

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Blocker
    • Resolution: Duplicate
    • Component/s: junit-plugin
    • Labels:
      None
    • Environment:
      Jenkins 2.46.3
      Junit plugin 1.22.2
      Pipeline API 2.23.1
      Pipeline declarative 1.2.4
    • Similar Issues:

      Description

      Since the Junit plugin upgrade to 1.22, the junit step do not not trigger unstable post steps anymore.

      Example of declarative pipeline to reproduce :

       

      pipeline {
        stages {
          stage('Build') {
            steps {
      
              ... Maven build with JUnit failures here
      
              junit testResults: '**/target/surefire-reports/TEST-*.xml'
            }
            post {
              always {
                echo "Pipeline status: ${currentBuild.result}"
              }
            }
          }
        }
        post {
          always {
            echo "Pipeline status: ${currentBuild.result}"
          }
          failure {
            echo 'Pipeline status : failure'
          }
          unstable {
            echo 'Pipeline status : unstable'
          }
          changed {
            echo 'Pipeline status : changed'
          }
        }
      }
      
      

       

      With this sample, the console output is :

      Pipeline status: null
      Pipeline status: null
      Pipeline status : changed

      The final state of the build is unstable :
      The unstable post steps (on stage or pipeline level) are never called :

        Attachments

          Issue Links

            Activity

            There are no comments yet on this issue.

              People

              • Assignee:
                Unassigned
                Reporter:
                mathieulaude Mathieu LL
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: