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

Build status set to failed but not failed immediately

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Critical
    • Resolution: Not A Defect
    • Component/s: xunit-plugin
    • Labels:
      None
    • Similar Issues:

      Description

      Running below code on test results

      step([$class: 'XUnitBuilder', 
        thresholds: [ 
          [$class: 'SkippedThreshold', failureThreshold: '0'], 
          [$class: 'FailedThreshold', failureThreshold: '0']],
        tools: [[$class: 'XUnitDotNetTestType', pattern: "xunit_result.xml"]] 
      ])
      

      produces this output:

      INFO: Starting to record. 
      INFO: Processing xUnit.Net-v2 (default) 
      INFO: [xUnit.Net-v2 (default)] - 1 test report file(s) were found with the pattern 'xunit_result.xml' relative to 'C:\Jenkins\Workspace\EDM Platform\druid\feature\publishToSandT\2' for the testing framework 'xUnit.Net-v2 (default)'. 
      INFO: Check 'Skipped Tests' threshold. 
      INFO: Check 'Failed Tests' threshold. 
      INFO: The total number of tests for this category exceeds the specified "failure" threshold value. 
      INFO: Setting the build status to FAILURE 
      INFO: Stopping recording.

      but it does not fail the build in the spot. Because of this all stages afterwards are done as normal, just after the whole process build is marked as failed:

      Post Action: Add badges
      [Pipeline] End of Pipeline
      [BFA] Scanning build for known causes...
      [BFA] No failure causes found
      [BFA] Done. 59s
      [Bitbucket] Notifying commit build result
      [Bitbucket] Build result notified
      [Office365connector] No webhooks to notify
      Finished: FAILURE
      

      so everything else (even other plugins, not just my code) assume success.

       

      I can workaround it checking the build status after processing results, but I don't think it is intended behaviour.

       

       

       

        Attachments

          Issue Links

            Activity

            Hide
            nfalco Nikolas Falco added a comment -

            It works as design, the XUnit builder/publisher marks the build status in agreement with the values of thresholds.
            Only the builder (deprecated) abort the build in case of errors when process reports and the option 'Stop and set the build to 'failed' status if there are errors when processing a result file' is enabled

            Show
            nfalco Nikolas Falco added a comment - It works as design, the XUnit builder/publisher marks the build status in agreement with the values of thresholds. Only the builder (deprecated) abort the build in case of errors when process reports and the option 'Stop and set the build to 'failed' status if there are errors when processing a result file' is enabled
            Hide
            quas Jakub Pawlinski added a comment -

            got it, the stopProcessingIfError parameter does it  had to use some old documentation or smth, thanks!

            xunit testTimeMargin: '3000', thresholdMode: 1, thresholds: [], tools: [MSTest(deleteOutputFiles: true, failIfNotNew: true, pattern: '', skipNoTestFiles: false, stopProcessingIfError: true)]
            
            Show
            quas Jakub Pawlinski added a comment - got it, the stopProcessingIfError parameter does it  had to use some old documentation or smth, thanks! xunit testTimeMargin: '3000' , thresholdMode: 1, thresholds: [], tools: [MSTest(deleteOutputFiles: true , failIfNotNew: true , pattern: '', skipNoTestFiles: false , stopProcessingIfError: true )]

              People

              • Assignee:
                nfalco Nikolas Falco
                Reporter:
                quas Jakub Pawlinski
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: