• Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • workflow-cps-plugin
    • None
    • workflow plugin 1.1

      As recorded in https://groups.google.com/d/msg/jenkinsci-dev/kgEc7vZQgi0/IC1rH_6KwNYJ:

      > does 'parallel' have a return value?

      It does not seem to be documented (and perhaps not tested) but it does
      seem to return a map of the return values of its branches. File an
      issue to make sure this is documented and tested (and works).

      I marked this as a 'bug' though arguably it's a feature request.

          [JENKINS-26033] Document and test return value for parallel

          Jesse Glick added a comment -

          I am tempted to say that the return value should just be null (unused). If you actually need to track the result of various branches, it is clearer to do so directly. For example:

          def x, y
          parallel one: {x = 1}, two: {y = 2}
          echo "x+y = ${x+y}"
          

          This also makes it obvious how to track exceptions in branches:

          def result
          parallel main: {
            try {
              node {sh 'false'}
              result = 'success'
            } catch (x) {
              result = "error: ${x}"
            }
          }
          echo result
          

          Jesse Glick added a comment - I am tempted to say that the return value should just be null (unused). If you actually need to track the result of various branches, it is clearer to do so directly. For example: def x, y parallel one: {x = 1}, two: {y = 2} echo "x+y = ${x+y}" This also makes it obvious how to track exceptions in branches: def result parallel main: { try { node {sh ' false ' } result = 'success' } catch (x) { result = "error: ${x}" } } echo result

          This makes sense to me.

          (I wonder how this design decision would affect JENKINS-26034, but I'll put my comments about that there.)

          Craig Silverstein added a comment - This makes sense to me. (I wonder how this design decision would affect JENKINS-26034 , but I'll put my comments about that there.)

          I think this is done now.

          Craig Silverstein added a comment - I think this is done now.

          Craig Ringer added a comment -

          It's not clear how this is done to me; it seems to still have the undocumented behaviour.

          If the retval isn't going to be blessed as a documented feature, it should be explicitly deprecated. "The parallel step's return value should be ignored, and is subject to change in future versions."

          Then an example of how results should be reported instead.

          Craig Ringer added a comment - It's not clear how this is done to me; it seems to still have the undocumented behaviour. If the retval isn't going to be blessed as a documented feature, it should be explicitly deprecated. "The parallel step's return value should be ignored, and is subject to change in future versions." Then an example of how results should be reported instead.

          Jesse Glick added a comment -

          Indeed it is still returning a Map so I do not know why csilvers closed this.

          Jesse Glick added a comment - Indeed it is still returning a Map so I do not know why csilvers closed this.

          Craig Ringer added a comment - - edited

          I created JENKINS-54514 with proposed documentation changes to address this and related matters. See https://github.com/jenkinsci/workflow-cps-plugin/pull/260 for the patch.

          Per this issue, I suggested the return value be ignored. But if it's not considered deprecated I'll tweak that.

          Craig Ringer added a comment - - edited I created JENKINS-54514 with proposed documentation changes to address this and related matters. See https://github.com/jenkinsci/workflow-cps-plugin/pull/260 for the patch. Per this issue, I suggested the return value be ignored. But if it's not considered deprecated I'll tweak that.

          Jesse Glick added a comment -

          In that case this can be considered a duplicate of the broader JENKINS-54514.

          Jesse Glick added a comment - In that case this can be considered a duplicate of the broader JENKINS-54514 .

            Unassigned Unassigned
            csilvers Craig Silverstein
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: