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

Stop executing build steps in case of failure within a post build step

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Done
    • Icon: Major Major
    • postbuildscript-plugin
    • None
    • jenkins/2.235.3 postbuildscript/2.9.1

      Let's assume a job with the following Execute Scripts post build steps (this syntax is of my own invention):

      postbuildSteps: 
        - postBuildStep1:
            runIfBuildStatusIs: 
              - success
            steps: 
              - buildStep1.1
              - buildStep1.2
        - postBuildStep2:
            runIfBuildStatusIs: 
              - success
              - failure
            steps: 
              - buildStep2.1
              - buildStep2.2
      

      JENKINS-50799 states that if any build step of a post build step fails, then the following post build steps should still be executed. Hence, if buildStep1.1 or buildStep1.2 fails, then postBuildStep2 should still be executed, which sounds reasonable.

      However, it looks like to implement this behavior (commit), the behavior of the post build script plugin was also changed to "Every build step of every post build step is executed, no matter if any build step failed." Indeed, if buildStep1.1 fails, then buildStep1.2 is also executed.

      This seems inconsistent with the behavior of classical build steps outside of the post build script plugin, where each step is only executed if its predecessor succeeded. Let's assume you have a job with two build steps 1 and 2, the expected behavior is that step 2 will not run if step 1 failed.

            dheid Daniel Heid
            acornet Alex Cornet
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: