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

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

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Component/s: postbuildscript-plugin
    • Labels:
      None
    • Environment:
      jenkins/2.235.3 postbuildscript/2.9.1
    • Similar Issues:

      Description

      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.

        Attachments

          Activity

          Hide
          acornet Alex Cornet added a comment -

          Great thanks Daniel! Sure, whatever works with your usual tracking habits is fine, I'll update the ticket name to be representative of the feature instead of the issue.

          Awesome thank you, happy to help review the PR when it's out there.

          Show
          acornet Alex Cornet added a comment - Great thanks Daniel! Sure, whatever works with your usual tracking habits is fine, I'll update the ticket name to be representative of the feature instead of the issue. Awesome thank you, happy to help review the PR when it's out there.
          Hide
          dheid Daniel Heid added a comment -

          I added the feature and will release a new version soon.

          Show
          dheid Daniel Heid added a comment - I added the feature and will release a new version soon.
          Hide
          dheid Daniel Heid added a comment -

          Alex Cornet I created a release of version 2.11.0. It will be available tomorrow. Would you be so kind and install the version tomorrow and test if your requirements are fulfilled? Thanks in advance!

          Show
          dheid Daniel Heid added a comment - Alex Cornet I created a release of version 2.11.0. It will be available tomorrow. Would you be so kind and install the version tomorrow and test if your requirements are fulfilled? Thanks in advance!
          Hide
          acornet Alex Cornet added a comment -

          Hi Daniel Heid, I just tested this locally and this is working smoothly, thanks for sorting this out so quickly!

          Best,

          Alex

          Show
          acornet Alex Cornet added a comment - Hi Daniel Heid , I just tested this locally and this is working smoothly, thanks for sorting this out so quickly! Best, Alex
          Hide
          dheid Daniel Heid added a comment -

          You are welcome!

          Show
          dheid Daniel Heid added a comment - You are welcome!

            People

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

              Dates

              Created:
              Updated:
              Resolved: