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

Allow an option for the pipeline step to throw an exception instead of setting the build status.

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • junit-plugin
    • None

      Sometimes I don't want the junit plugin to mark a build as failed when it publishes a failed test. Other pipeline tasks throw exceptions instead of just marking the build as a failure, and once the JUnit plugin sets the status, I can't unset that status due to how setResult works in hudson/model/Run. I would really like a parameter to override this default behavior and just throw an exception instead of marking the whole build as a failure.

       

      The use cases I've found for something like this are as follows:

      • We use a lot of different parallel tasks in our Jenkinsfiles. Instead of failing the Jenkins build, we prefer to use individually updated status checks on our github PRs that we manage. For example, we might have a check for "Unit Tests" that would get failed, but the job would still be marked as passing. There isn't much value in seeing that the build failed for us, because all that says is one of X types of CI that we run has failed. I would rather leave that passing and only mark the unit test check as failed.
      • When we first introduce a new type of CI task to our Jenkinsfiles, we like to have them not publicly report statuses for the first week or two so that we can verify that there will be no flakiness. In this stage, we cannot use the JUnit plugin or it will force itself to be publicly displayed.

            vlatombe Vincent Latombe
            spencermalone Spencer Malone
            Votes:
            3 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: