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

Unstable main build leads to post steps being executed even if configured not to

      When a build "fails" due to test failures, and post steps are configured with the option "Run only if build succeeds", these post steps are still executed.

      (Jenkins 1.467)

          [JENKINS-14102] Unstable main build leads to post steps being executed even if configured not to

          Thomas Demande created issue -

          I'm having the same issue on my builds.

          Please Jenkins' team take about it, it's so annoying .... dev team is complain a lot about it for me.

          Giuliano Ribeiro added a comment - I'm having the same issue on my builds. Please Jenkins' team take about it, it's so annoying .... dev team is complain a lot about it for me.

          Glenn Hudson added a comment -

          The issue is in;
          hudson.maven.reporters.SurefireArchiver
          (${jenkins}\maven-plugin\src\main\java\hudson\maven\reporters\SurefireArchiver.java)

          The awkward behavior since 2010 has been that if a unit test fails that the build is actually a SUCCESS. This has the result of the post steps always running if a unit test has failed.

          A potential way to fix this would be to add a configuration option (globally or for the build) that jobs with failed unit tests should not be "markAsSuccess".

          Code quality issue;
          MavenBuilder.markAsSuccess = true;
          Maven3Builder.markAsSuccess = true;
          An alternative to public static booleans should probably be found!

          Glenn Hudson added a comment - The issue is in; hudson.maven.reporters.SurefireArchiver (${jenkins}\maven-plugin\src\main\java\hudson\maven\reporters\SurefireArchiver.java) The awkward behavior since 2010 has been that if a unit test fails that the build is actually a SUCCESS. This has the result of the post steps always running if a unit test has failed. A potential way to fix this would be to add a configuration option (globally or for the build) that jobs with failed unit tests should not be "markAsSuccess". Code quality issue; MavenBuilder.markAsSuccess = true; Maven3Builder.markAsSuccess = true; An alternative to public static booleans should probably be found!

          Daniel Haas added a comment -

          Hi everyone. I need this bug/feature so much that I'm willing to pay 50.00 bucks for it.
          This offer is registered at FreedomSponsors (http://www.freedomsponsors.org/core/issue/51/unstable-main-build-leads-to-post-steps-being-executed-even-if-configured-not-to).
          Once you solve it (according to the acceptance criteria described there), just create a FreedomSponsors account and mark it as resolved (oh, you'll need a Paypal account too)
          I'll then check it out and will gladly pay up!

          If anyone else would like to throw in a few bucks to elevate the priority on this issue, you should check out FreedomSponsors!

          Daniel Haas added a comment - Hi everyone. I need this bug/feature so much that I'm willing to pay 50.00 bucks for it. This offer is registered at FreedomSponsors ( http://www.freedomsponsors.org/core/issue/51/unstable-main-build-leads-to-post-steps-being-executed-even-if-configured-not-to ). Once you solve it (according to the acceptance criteria described there), just create a FreedomSponsors account and mark it as resolved (oh, you'll need a Paypal account too) I'll then check it out and will gladly pay up! If anyone else would like to throw in a few bucks to elevate the priority on this issue, you should check out FreedomSponsors!

          Peter S added a comment - - edited

          please give more details - which post-build steps you use? or provide <publishers> section content of job's xml config file

          Peter S added a comment - - edited please give more details - which post-build steps you use? or provide <publishers> section content of job's xml config file

          Daniel Haas added a comment -

          I'm executing a shell script afterwards. Actually what it is it should test first my build (maven build) and if the tests fail the script should be not executed.
          I put it into the Post Steps...

          Actually publishers is empty:

          <publishers/>

          There are stored postbuilders:

          <postbuilders>
          <hudson.tasks.Shell>
          <command>env && ./jdeploy $Server</command>
          </hudson.tasks.Shell>
          </postbuilders>

          In the jenkins web interface it is:

          Post Steps
          Run only if build succeeds
          Run only if build succeeds or is unstable
          Run regardless of build result

          Should the post-build steps run only for successful builds, etc.

          Execute shell

          Command env && ./jdeploy $Server

          Daniel Haas added a comment - I'm executing a shell script afterwards. Actually what it is it should test first my build (maven build) and if the tests fail the script should be not executed. I put it into the Post Steps... Actually publishers is empty: <publishers/> There are stored postbuilders: <postbuilders> <hudson.tasks.Shell> <command>env && ./jdeploy $Server</command> </hudson.tasks.Shell> </postbuilders> In the jenkins web interface it is: Post Steps Run only if build succeeds Run only if build succeeds or is unstable Run regardless of build result Should the post-build steps run only for successful builds, etc. Execute shell Command env && ./jdeploy $Server

          I'm using "Invoke top-level Maven targets" post steps.

          Thomas Demande added a comment - I'm using "Invoke top-level Maven targets" post steps.

          Peter S added a comment -

          Could you check, does <runPostStepsIfResult>success</runPostStepsIfResult> exists in job's xml config

          Peter S added a comment - Could you check, does <runPostStepsIfResult>success</runPostStepsIfResult> exists in job's xml config

          I got this in the end of the job config file:

          <runPostStepsIfResult>
              <name>SUCCESS</name>
              <ordinal>0</ordinal>
              <color>BLUE</color>
            </runPostStepsIfResult>
          

          Thomas Demande added a comment - I got this in the end of the job config file: <runPostStepsIfResult> <name> SUCCESS </name> <ordinal> 0 </ordinal> <color> BLUE </color> </runPostStepsIfResult>

          Daniel Haas added a comment -

          I have the same as Thomas

          Daniel Haas added a comment - I have the same as Thomas

            abayer Andrew Bayer
            tdemande Thomas Demande
            Votes:
            7 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: