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

xunit step failure is not displayed

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Same issue as described in https://issues.jenkins-ci.org/browse/JENKINS-47142, except, for xunit step, not archiveArtifacts step.

       

      The issue looks to be that the exception is swallowed here - https://github.com/jenkinsci/xunit-plugin/blob/master/src/main/java/org/jenkinsci/plugins/xunit/XUnitPublisher.java#L164 meaning that it's not able to be handled upstream.

      The result is that the stage shows as successful, but the build fails.

      A simple test case that reproduces the issue:

      node {
          stage('stage 1') {
              git 'https://github.com/dantheman213/java-hello-world-maven.git'
              sh 'mvn clean package'
              xunit testTimeMargin: '3000', thresholdMode: 1, thresholds: [failed(), passed(), skipped()], tools: [JUnit(deleteOutputFiles: true, failIfNotNew: true, pattern: 'target/failsafe-reports/*.xml', skipNoTestFiles: false, stopProcessingIfError: true)]
          }
          stage('stage 2') {
              echo 'hello from stage 2'
          }
      } 
      

       

        Attachments

          Issue Links

            Activity

            owood Owen Wood created issue -
            owood Owen Wood made changes -
            Field Original Value New Value
            Status Open [ 1 ] In Progress [ 3 ]
            Show
            owood Owen Wood added a comment - Created https://github.com/jenkinsci/xunit-plugin/pull/64
            owood Owen Wood made changes -
            Status In Progress [ 3 ] In Review [ 10005 ]
            Hide
            owood Owen Wood added a comment -

            Nikolas Falco could you review?

            Show
            owood Owen Wood added a comment - Nikolas Falco could you review?
            owood Owen Wood made changes -
            Description Same issue as described in https://issues.jenkins-ci.org/browse/JENKINS-47142, except, for xunit step, not archiveArtifacts step.

             

            The issue looks to be that the exception is swallowed here - [https://github.com/jenkinsci/xunit-plugin/blob/master/src/main/java/org/jenkinsci/plugins/xunit/XUnitPublisher.java#L164] meaning that it's not able to be handled upstream. Not confirmed.

            The result is that the stage shows as successful, but the build fails.

            A simple test case that reproduces the issue:

            {code}
            node {
                stage('stage 1') {
                    git 'https://github.com/dantheman213/java-hello-world-maven.git'
                    sh 'mvn clean package'
                    xunit testTimeMargin: '3000', thresholdMode: 1, thresholds: [failed(), passed(), skipped()], tools: [JUnit(deleteOutputFiles: true, failIfNotNew: true, pattern: 'target/failsafe-reports/*.xml', skipNoTestFiles: false, stopProcessingIfError: true)]
                }
                stage('stage 2') {
                    echo 'hello from stage 2'
                }
            }
            {code}
             
            Same issue as described in https://issues.jenkins-ci.org/browse/JENKINS-47142, except, for xunit step, not archiveArtifacts step.

             

            The issue looks to be that the exception is swallowed here - [https://github.com/jenkinsci/xunit-plugin/blob/master/src/main/java/org/jenkinsci/plugins/xunit/XUnitPublisher.java#L164] meaning that it's not able to be handled upstream.

            The result is that the stage shows as successful, but the build fails.

            A simple test case that reproduces the issue:

            {code}
            node {
                stage('stage 1') {
                    git 'https://github.com/dantheman213/java-hello-world-maven.git'
                    sh 'mvn clean package'
                    xunit testTimeMargin: '3000', thresholdMode: 1, thresholds: [failed(), passed(), skipped()], tools: [JUnit(deleteOutputFiles: true, failIfNotNew: true, pattern: 'target/failsafe-reports/*.xml', skipNoTestFiles: false, stopProcessingIfError: true)]
                }
                stage('stage 2') {
                    echo 'hello from stage 2'
                }
            }
            {code}
             
            Hide
            owood Owen Wood added a comment -

            The change now means that a stage failure will be reported correctly as failed.

            Show
            owood Owen Wood added a comment - The change now means that a stage failure will be reported correctly as failed.
            nfalco Nikolas Falco made changes -
            Status In Review [ 10005 ] Closed [ 6 ]
            Resolution Not A Defect [ 7 ]
            Hide
            nfalco Nikolas Falco added a comment -

            Publishers (or Recorder) like xunit (and junit) does not stop the build. Normally in a standard project they are post build steps and all of them are executed. In a pipeline you can mix them but the behavior is the same, a failure does not cause the pipeline to stop.

            Show
            nfalco Nikolas Falco added a comment - Publishers (or Recorder) like xunit (and junit) does not stop the build. Normally in a standard project they are post build steps and all of them are executed. In a pipeline you can mix them but the behavior is the same, a failure does not cause the pipeline to stop.
            nfalco Nikolas Falco made changes -
            Link This issue duplicates JENKINS-52814 [ JENKINS-52814 ]
            Show
            owood Owen Wood added a comment - Re-opening. Nikolas Falco Please see: https://github.com/jenkinsci/xunit-plugin/pull/64#issuecomment-423283014 https://github.com/jenkinsci/xunit-plugin/pull/64#issuecomment-423285754
            owood Owen Wood made changes -
            Resolution Not A Defect [ 7 ]
            Status Closed [ 6 ] Reopened [ 4 ]
            Hide
            nfalco Nikolas Falco added a comment -

            The link you are speaking in the PR is done for steps that does not handle build status it self.

            Have a look to other publish strategy, none of them throws exception.

            • hudson.tasks.Fingerprinter.perform()
            • hudson.tasks.ArtifactArchiver.perform()
            • hudson.tasks.Mailer.perform() (perform an e.printStackTrace to listener -> console)
            • hudson.plugins.sonar.SonarPublisher.perform() -> (exception captured and handled in executeSonar())
            • ...
            Show
            nfalco Nikolas Falco added a comment - The link you are speaking in the PR is done for steps that does not handle build status it self. Have a look to other publish strategy, none of them throws exception. hudson.tasks.Fingerprinter.perform() hudson.tasks.ArtifactArchiver.perform() hudson.tasks.Mailer.perform() (perform an e.printStackTrace to listener -> console) hudson.plugins.sonar.SonarPublisher.perform() -> (exception captured and handled in executeSonar()) ...
            nfalco Nikolas Falco made changes -
            Status Reopened [ 4 ] Fixed but Unreleased [ 10203 ]
            Resolution Fixed [ 1 ]
            nfalco Nikolas Falco made changes -
            Status Fixed but Unreleased [ 10203 ] Resolved [ 5 ]

              People

              • Assignee:
                owood Owen Wood
                Reporter:
                owood Owen Wood
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: