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

DP should have an easy way to say don't run subsequent steps if result is set.

      If I have a pipeline with a lot of stages

      • run unit tests
      • run smoke tests
      • run quick ATH
      • run slow ATH
      • deploy to staging
      • run UAT
      • run even more tests

      If anything sets the build result to anything other than SUCCESS in one of the stages (e.g. unit test failures and junit plugin -> UNSTABLE) then I do not want to run the subsequent tests.

      Currently I have to remember to put the following on every stage - which is cumbersome and error prone.

      when { expression { currentBuild.result == null } }
      

      It would be useful if there was a config option like skipSubsequentStagesWhenNotSucessfull : true at the top level which could be overridden by a stage if needed (e.g. a final reporter stage...)

      Obviously the configuration name above is bad - but just for example...

          [JENKINS-41943] DP should have an easy way to say don't run subsequent steps if result is set.

          Jesse Glick added a comment -

          JENKINS-27092 would provide a more straightforward approach for scripted Pipelines. Probably it could not be used from Declarative (without a script step).

          Jesse Glick added a comment - JENKINS-27092 would provide a more straightforward approach for scripted Pipelines. Probably it could not be used from Declarative (without a script step).

          Jesse Glick added a comment -

          Actually I guess you could have

          post {unstable {error message: 'Not continuing', result: 'UNSTABLE'}}
          

          Jesse Glick added a comment - Actually I guess you could have post {unstable {error message: 'Not continuing' , result: 'UNSTABLE' }}

          Andrew Bayer added a comment -

          I think this is addressed by JENKINS-42039.

          Andrew Bayer added a comment - I think this is addressed by JENKINS-42039 .

          Liam Newman added a comment -

          Bulk closing resolved issues.

          Liam Newman added a comment - Bulk closing resolved issues.

            abayer Andrew Bayer
            teilo James Nord
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: