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

Parallel step and closure scope

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Critical
    • Resolution: Fixed
    • Component/s: workflow-cps-plugin
    • Labels:
    • Environment:
    • Similar Issues:

      Description

      I'm experiencing some odd behaviour with the parallel step related to variable scoping. The following minimal pipeline script demonstrates my problem.

      def fn = { val -> println val }
      
      parallel([
        a: { fn('a') },
        b: { fn('b') }
      ])
      

      Expected output

      a
      b
      

      (or b then a, order of execution should be undefined)

      Actual output

      b
      b
      

        Attachments

        1. console_output_no_node_step.png
          console_output_no_node_step.png
          56 kB
        2. console_output.png
          console_output.png
          137 kB
        3. pipeline_step.png
          pipeline_step.png
          222 kB
        4. pipeline_steps.png
          pipeline_steps.png
          137 kB

          Issue Links

            Activity

            philgrayson Phil Grayson created issue -
            jglick Jesse Glick made changes -
            Field Original Value New Value
            Link This issue relates to JENKINS-38052 [ JENKINS-38052 ]
            jglick Jesse Glick made changes -
            Component/s pipeline [ 21692 ]
            jglick Jesse Glick made changes -
            Labels parallel pipeline parallel
            abayer Andrew Bayer made changes -
            Link This issue duplicates JENKINS-26481 [ JENKINS-26481 ]
            abayer Andrew Bayer made changes -
            Resolution Duplicate [ 3 ]
            Status Open [ 1 ] Resolved [ 5 ]
            jglick Jesse Glick made changes -
            Assignee Jesse Glick [ jglick ]
            Resolution Duplicate [ 3 ]
            Status Resolved [ 5 ] Reopened [ 4 ]
            jglick Jesse Glick made changes -
            Epic Link JENKINS-35390 [ 171183 ]
            nvgoldin Nadav Goldin made changes -
            Attachment pipeline_steps.png [ 36077 ]
            jglick Jesse Glick made changes -
            Priority Major [ 3 ] Critical [ 2 ]
            jglick Jesse Glick made changes -
            Status Reopened [ 4 ] Open [ 1 ]
            philgrayson Phil Grayson made changes -
            Description I'm experiencing some odd behaviour with the parallel step related to variable scoping. The following minimal pipeline script demonstrates my problem.

            {code:java}
            def closure = { val ->
              node { }
              println val
            }

            parallel([
              a: { closure.call('a') },
              b: { closure.call('b') }
            ])
            {code}

            Expected output
            {code}
            a
            b
            {code}
            (or b then a, order of execution should be undefined)

            Actual output
            {code}
            b
            b
            {code}

            Modifying the pipeline script to remove the {{node}} step *does* produce the expected output. Therefore calling {{node}} somehow triggers this change in behaviour.
            I'm experiencing some odd behaviour with the parallel step related to variable scoping. The following minimal pipeline script demonstrates my problem.
            {code:java}
            def closure = { val ->
              node { }
              println val
            }

            parallel([
              a: { closure.call('a') },
              b: { closure.call('b') }
            ])
            {code}
            Expected output
            {code:java}
            a
            b
            {code}
            (or b then a, order of execution should be undefined)

            Actual output
            {code:java}
            b
            b
            {code}
            Modifying the pipeline script to remove the {{node}} step *does* produce the expected output. Therefore calling {{node}} somehow triggers this change in behaviour.
            philgrayson Phil Grayson made changes -
            Description I'm experiencing some odd behaviour with the parallel step related to variable scoping. The following minimal pipeline script demonstrates my problem.
            {code:java}
            def closure = { val ->
              node { }
              println val
            }

            parallel([
              a: { closure.call('a') },
              b: { closure.call('b') }
            ])
            {code}
            Expected output
            {code:java}
            a
            b
            {code}
            (or b then a, order of execution should be undefined)

            Actual output
            {code:java}
            b
            b
            {code}
            Modifying the pipeline script to remove the {{node}} step *does* produce the expected output. Therefore calling {{node}} somehow triggers this change in behaviour.
            I'm experiencing some odd behaviour with the parallel step related to variable scoping. The following minimal pipeline script demonstrates my problem.
            {code:java}
            def fn = { val -> println val }

            parallel([
              a: { fn('a') },
              b: { fn('b') }
            ])
            {code}
            Expected output
            {code:java}
            a
            b
            {code}
            (or b then a, order of execution should be undefined)

            Actual output
            {code:java}
            b
            b
            {code}
            markl_lagendijk Mark Lagendijk made changes -
            Link This issue relates to JENKINS-44746 [ JENKINS-44746 ]
            jglick Jesse Glick made changes -
            Assignee Andrew Bayer [ abayer ]
            jglick Jesse Glick made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            abayer Andrew Bayer made changes -
            Status In Progress [ 3 ] In Review [ 10005 ]
            abayer Andrew Bayer made changes -
            Remote Link This issue links to "PR #61 (Web Link)" [ 17112 ]
            abayer Andrew Bayer made changes -
            Remote Link This issue links to "workflow-cps PR #143 (integration test) (Web Link)" [ 17128 ]
            jglick Jesse Glick made changes -
            Resolution Fixed [ 1 ]
            Status In Review [ 10005 ] Resolved [ 5 ]
            jglick Jesse Glick made changes -
            Link This issue is duplicated by JENKINS-36964 [ JENKINS-36964 ]
            leedega Kevin Phillips made changes -
            Link This issue is related to JENKINS-55040 [ JENKINS-55040 ]

              People

              Assignee:
              abayer Andrew Bayer
              Reporter:
              philgrayson Phil Grayson
              Votes:
              16 Vote for this issue
              Watchers:
              28 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: