• 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 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 made changes -
          Link New: This issue is related to JENKINS-26300 [ JENKINS-26300 ]
          Jesse Glick made changes -
          Remote Link New: This issue links to "groovy-cps #8 (Web Link)" [ 12153 ]
          Jesse Glick made changes -
          Remote Link New: This issue links to "groovy-cps #9 (Web Link)" [ 12154 ]
          Jesse Glick made changes -
          Remote Link New: This issue links to "groovy-cps #7 (Web Link)" [ 12155 ]
          Jesse Glick made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Jesse Glick made changes -
          Summary Original: Closures only executed once in Groovy CPS DSL scripts New: Mishandling of binary methods accepting Closure
          Back Slasher made changes -
          Link New: This issue is related to JENKINS-28599 [ JENKINS-28599 ]
          Jesse Glick made changes -
          Link New: This issue is related to JENKINS-31314 [ JENKINS-31314 ]

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

              Created:
              Updated:
              Resolved: