• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • workflow-cps-plugin
    • Jenkins LTS 1.580.2 and workflow-plugin 1.1. Both are the latest versions at the time of this writing. Tested on RHEL 6 with OpenJDK 1.7 and Fedora 21 with OpenJDK 1.8.

      At least some closures are executed only once inside of Groovy CPS DSL scripts managed by the workflow plugin.

      Steps to reproduce:
      1. Create a new workflow with the following script:
      node {
      [1, 2, 3].each

      { println it }

      println "abc".replaceAll(/[a-z]/)

      { it.toUpperCase() }

      }
      2. Build the workflow

      Actual output:
      Started by user anonymous
      Running: Allocate node : Start
      Running on master in /var/lib/jenkins/jobs/testflow/workspace
      Running: Allocate node : Body : Start
      Running: Print Message
      1
      Running: Print Message
      A
      Running: Allocate node : Body : End
      Running: Allocate node : End
      Running: End of Workflow
      Finished: SUCCESS

      Expected output:
      Started by user anonymous
      Running: Allocate node : Start
      Running on master in /var/lib/jenkins/jobs/testflow/workspace
      Running: Allocate node : Body : Start
      Running: Print Message
      1
      Running: Print Message
      2
      Running: Print Message
      3
      Running: Print Message
      ABC
      Running: Allocate node : Body : End
      Running: Allocate node : End
      Running: End of Workflow
      Finished: SUCCESS

          [JENKINS-26481] Mishandling of binary methods accepting Closure

          Daniel Tschan created issue -

          Jesse Glick added a comment -

          Sounds like a bad implementation of something in the groovy-cps library.

          Jesse Glick added a comment - Sounds like a bad implementation of something in the groovy-cps library.
          Jesse Glick made changes -
          Assignee Original: Jesse Glick [ jglick ] New: Kohsuke Kawaguchi [ kohsuke ]
          Jesse Glick made changes -
          Link New: This issue is duplicated by JENKINS-26699 [ JENKINS-26699 ]

          Jesse Glick added a comment -

          JENKINS-26300 sounds similar, perhaps with the same root cause.

          Jesse Glick added a comment - JENKINS-26300 sounds similar, perhaps with the same root cause.
          Jesse Glick made changes -
          Link New: This issue is related to JENKINS-26300 [ JENKINS-26300 ]

          Jesse Glick added a comment -

          groovy-cps #8 covers the particular case reported here: there is an implementation of each for CPS-transformed code, but for reasons still TBD it is not getting used when called on an array (it is used for example on sequences).

          Jesse Glick added a comment - groovy-cps #8 covers the particular case reported here: there is an implementation of each for CPS-transformed code, but for reasons still TBD it is not getting used when called on an array (it is used for example on sequences).
          Jesse Glick made changes -
          Remote Link New: This issue links to "groovy-cps #8 (Web Link)" [ 12153 ]

          Jesse Glick added a comment -

          groovy-cps #9 would allow closures to run synchronously, permitting routine functional-style programs to be used so long as the closures were not trying to do long-running tasks like calling shell steps.

          Jesse Glick added a comment - groovy-cps #9 would allow closures to run synchronously, permitting routine functional-style programs to be used so long as the closures were not trying to do long-running tasks like calling shell steps.
          Jesse Glick made changes -
          Remote Link New: This issue links to "groovy-cps #9 (Web Link)" [ 12154 ]

            jglick Jesse Glick
            dtschan Daniel Tschan
            Votes:
            108 Vote for this issue
            Watchers:
            137 Start watching this issue

              Created:
              Updated:
              Resolved: