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

Ability to fail the build in case the publisher fails

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major Major
    • testng-plugin
    • None

      If a failure happens during the publisher process, the step fails but the build succeed.

      For example:

      ...
      TestNG Reports Processing: START
      Looking for TestNG results report in workspace using pattern: **/testng-results.xml
      Saving reports...
      Processing '/var/jenkins_home/jobs/myjob/builds/1/testng/testng-results.xml'
      java.lang.NullPointerException
      Found matching files but did not find any TestNG results.
      ...
      Finished: SUCCESS
      

      It would be great if there was an option, like for example the JUnit publisher, to fail the build if the step fails.

          [JENKINS-47620] Ability to fail the build in case the publisher fails

          Allan BURDAJEWICZ added a comment - - edited

          While this is a problem in freestyle jobs, this is also a problem in Pipeline:

          node {
          
              stage ('TestNG') {
                  step([$class: 'Publisher', reportFilenamePattern: '**/testng-results.xml'])
              }
              
              stage ('JUnit') {
                  junit '**/test-reports/*.xml'
              }
              
          }
          

          TestNG don't find any file and don't fail the build. No easy way to decide to fail the build or no.
          JUnit don't find any file and fails the build. This can be then controlled with a try...catch.

          Allan BURDAJEWICZ added a comment - - edited While this is a problem in freestyle jobs, this is also a problem in Pipeline: node { stage ( 'TestNG' ) { step([$class: 'Publisher' , reportFilenamePattern: '**/testng-results.xml' ]) } stage ( 'JUnit' ) { junit '**/test-reports/*.xml' } } TestNG don't find any file and don't fail the build. No easy way to decide to fail the build or no. JUnit don't find any file and fails the build. This can be then controlled with a try...catch.

            Unassigned Unassigned
            allan_burdajewicz Allan BURDAJEWICZ
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: