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

build.state.result always SUCCESS in guard block

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Won't Fix
    • Component/s: build-flow-plugin
    • Labels:
      None
    • Environment:
      Jenkins 1.639
    • Similar Issues:

      Description

      build.state.result should return FAILURE in the guard block, but always returns SUCCESS.

      Script

      import hudson.model.Result
      
      def run_builds(){
          parallel (
          {
              ignore(FAILURE) {build("Tests/TestSuccess")}
              build("Tests/TestSuccess")
          },
          {
              build("Tests/TestSuccess")
              build("Tests/TestFailure")
          },
      )}
      
      guard {
          run_builds()
      } rescue {
          out.println "Result should be FAILURE but is $build.state.result"
      }
      

      Output console

      guard {
          parallel {
              Schedule job Jenkins internal tests » TestSuccess
              ignore(FAILURE) {
                  Schedule job Jenkins internal tests » TestSuccess
                  Build Jenkins internal tests » TestSuccess #20 started
                  Build Jenkins internal tests » TestSuccess #20 started
                  Jenkins internal tests » TestSuccess #20 completed 
                  Jenkins internal tests » TestSuccess #20 completed 
                  // SUCCESS ignored
              }
              Schedule job Jenkins internal tests » TestFailure
              Schedule job Jenkins internal tests » TestSuccess
              Build Jenkins internal tests » TestFailure #12 started
              Build Jenkins internal tests » TestSuccess #21 started
              Jenkins internal tests » TestFailure #12 completed  : FAILURE
              Jenkins internal tests » TestSuccess #21 completed 
          }
      } rescue {
      Result should be FAILURE but is SUCCESS
      }
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              martin_stolle Martin Stolle
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: