build.state.result always SUCCESS in guard block

XMLWordPrintable

    • Type: Bug
    • Resolution: Won't Fix
    • Priority: Major
    • Component/s: build-flow-plugin
    • None
    • Environment:
      Jenkins 1.639

      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
      }
      

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

              Created:
              Updated:
              Resolved: