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

wrong build result in post build steps after failed pre build step in maven project

      When the build status is set as FAILURE by a triggered Build in a pre-build step, the current build status is not recognised in a post-build conditional step, and the step in performed regardless of the condition.

      Steps to reproduce:

      • create a freestyle project 'i_will_fail'
      • add step "run shell" with "exit 1" as content
      • create maven project
      • add pre-build step Trigger 'i_will_fail'
      • block job until 'i_will_fail' returns...leave default marks build as.
      • for the main build some test pom.xml and goals validate (this is irrelevant)
      • post-steps - run regardless of result
      • add a conditional post-build step with current build status success.
      • this step will run even if the build has been marked as failed in the pre-build step.

      Here is the output from a test I made.

      Started by user lostinberlin
      [EnvInject] - Loading node environment variables.
      Building in workspace /var/lib/jenkins/jobs/_lostinberlin_Sandbox_Maven/workspace
      Run condition [Current build status] enabling prebuild for step [Execute shell]
      Run condition [Current build status] enabling prebuild for step [Execute shell]
      [workspace] $ /bin/sh -xe /tmp/hudson3522507109509654665.sh
      + echo '_lostinberlin_Sandbox_Maven : Starting...'
      _lostinberlin_Sandbox_Maven : Starting...
      Waiting for the completion of _lostinberlin_Sandbox
      _lostinberlin_Sandbox #18 completed. Result was FAILURE
      Build step 'Trigger/call builds on other projects' marked build as failure
      Run condition [Current build status] enabling perform for step [Execute shell]
      [workspace] $ /bin/sh -xe /tmp/hudson3662062057434345391.sh
      + echo '_lostinberlin_Sandbox_Maven : In post-build steps. I should not be run...'
      _lostinberlin_Sandbox_Maven : In post-build steps. I should not be run...
      Notifying upstream projects of job completion
      Finished: FAILURE
      

          [JENKINS-17177] wrong build result in post build steps after failed pre build step in maven project

          The issues can also be reproduced with a simple shell builder (instead of triggering an other project).

          But the bug actually is in the maven plugin, the result of the prebuild steps are not correctly propagated and therefore the post build steps have no chance to react as expected.

          Dominik Bartholdi added a comment - The issues can also be reproduced with a simple shell builder (instead of triggering an other project). But the bug actually is in the maven plugin, the result of the prebuild steps are not correctly propagated and therefore the post build steps have no chance to react as expected.

          Code changed in jenkins
          User: imod
          Path:
          changelog.html
          maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
          test/src/test/java/hudson/maven/MavenProjectTest.java
          test/src/test/java/hudson/maven/ResultExposingBuilder.java
          http://jenkins-ci.org/commit/jenkins/320eea930e27330a38f32b4feb3a9cc2287054e5
          Log:
          [FIXED JENKINS-17177] wrong build result in post build steps after failed pre build step in maven project


          You received this message because you are subscribed to the Google Groups "Jenkins Commits" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscribe@googlegroups.com.
          For more options, visit https://groups.google.com/groups/opt_out.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: imod Path: changelog.html maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java test/src/test/java/hudson/maven/MavenProjectTest.java test/src/test/java/hudson/maven/ResultExposingBuilder.java http://jenkins-ci.org/commit/jenkins/320eea930e27330a38f32b4feb3a9cc2287054e5 Log: [FIXED JENKINS-17177] wrong build result in post build steps after failed pre build step in maven project – You received this message because you are subscribed to the Google Groups "Jenkins Commits" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out .

          dogfood added a comment -

          Integrated in jenkins_main_trunk #2378
          [FIXED JENKINS-17177] wrong build result in post build steps after failed pre build step in maven project (Revision 320eea930e27330a38f32b4feb3a9cc2287054e5)

          Result = SUCCESS
          imod : 320eea930e27330a38f32b4feb3a9cc2287054e5
          Files :

          • test/src/test/java/hudson/maven/ResultExposingBuilder.java
          • test/src/test/java/hudson/maven/MavenProjectTest.java
          • maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
          • changelog.html

          dogfood added a comment - Integrated in jenkins_main_trunk #2378 [FIXED JENKINS-17177] wrong build result in post build steps after failed pre build step in maven project (Revision 320eea930e27330a38f32b4feb3a9cc2287054e5) Result = SUCCESS imod : 320eea930e27330a38f32b4feb3a9cc2287054e5 Files : test/src/test/java/hudson/maven/ResultExposingBuilder.java test/src/test/java/hudson/maven/MavenProjectTest.java maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java changelog.html

          Thanks for the quick response.

          Steve Boardwell added a comment - Thanks for the quick response.

          Code changed in jenkins
          User: imod
          Path:
          src/main/java/hudson/maven/MavenModuleSetBuild.java
          http://jenkins-ci.org/commit/maven-plugin/e1a7d04884bec75551bb5dc6222f143cdbc35d17
          Log:
          [FIXED JENKINS-17177] wrong build result in post build steps after failed pre build step in maven project

          Originally-Committed-As: 320eea930e27330a38f32b4feb3a9cc2287054e5

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: imod Path: src/main/java/hudson/maven/MavenModuleSetBuild.java http://jenkins-ci.org/commit/maven-plugin/e1a7d04884bec75551bb5dc6222f143cdbc35d17 Log: [FIXED JENKINS-17177] wrong build result in post build steps after failed pre build step in maven project Originally-Committed-As: 320eea930e27330a38f32b4feb3a9cc2287054e5

            domi Dominik Bartholdi
            lostinberlin Steve Boardwell
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: