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

XMLWordPrintable

      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
      

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

              Created:
              Updated:
              Resolved: