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

Mishandling of binary methods accepting Closure

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      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

        Attachments

          Issue Links

            Activity

            dtschan Daniel Tschan created issue -
            jglick Jesse Glick made changes -
            Field Original Value New Value
            Assignee Jesse Glick [ jglick ] Kohsuke Kawaguchi [ kohsuke ]
            jglick Jesse Glick made changes -
            Link This issue is duplicated by JENKINS-26699 [ JENKINS-26699 ]
            jglick Jesse Glick made changes -
            Link This issue is related to JENKINS-26300 [ JENKINS-26300 ]
            jglick Jesse Glick made changes -
            Remote Link This issue links to "groovy-cps #8 (Web Link)" [ 12153 ]
            jglick Jesse Glick made changes -
            Remote Link This issue links to "groovy-cps #9 (Web Link)" [ 12154 ]
            jglick Jesse Glick made changes -
            Remote Link This issue links to "groovy-cps #7 (Web Link)" [ 12155 ]
            jglick Jesse Glick made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            jglick Jesse Glick made changes -
            Summary Closures only executed once in Groovy CPS DSL scripts Mishandling of binary methods accepting Closure
            backslasher Back Slasher made changes -
            Link This issue is related to JENKINS-28599 [ JENKINS-28599 ]
            jglick Jesse Glick made changes -
            Link This issue is related to JENKINS-31314 [ JENKINS-31314 ]
            jglick Jesse Glick made changes -
            Labels kohsuke-plane-project
            jglick Jesse Glick made changes -
            Remote Link This issue links to "PR 372 (Web Link)" [ 14143 ]
            jglick Jesse Glick made changes -
            Link This issue depends on JENKINS-27421 [ JENKINS-27421 ]
            jglick Jesse Glick made changes -
            Link This issue depends on JENKINS-34064 [ JENKINS-34064 ]
            okram999 Niristotle Okram made changes -
            Comment [ Using latest pipeline plugin(s) of 2.1. The below code worked once with the iteration. And it stopped (strange) why only once.

            node('win-slave4') {
            checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'CleanBeforeCheckout']], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'cca9c557-2-9176-f78d91c22907', url: 'git@github.com:someProjects/testopy.git']]])

            def paths = ['folder1', 'folder2', 'folder3']
            def dirs = ['dst1', 'dst2', 'dst3']

            [paths, dirs].transpose().each { pd ->
                def path = pd[0]
                def dir = pd[1]
                bat "xcopy %cd%\\${path} C:\\${dir} /E /Y /V"
                }
              } ]
            jglick Jesse Glick made changes -
            Link This issue is duplicated by JENKINS-32451 [ JENKINS-32451 ]
            jglick Jesse Glick made changes -
            Labels kohsuke-plane-project groovy kohsuke-plane-project
            jglick Jesse Glick made changes -
            Remote Link This issue links to "workflow-cps PR 15 (Web Link)" [ 14412 ]
            jglick Jesse Glick made changes -
            Remote Link This issue links to "groovy-cps PR 24 (Web Link)" [ 14413 ]
            jglick Jesse Glick made changes -
            Epic Link JENKINS-35390 [ 171183 ]
            jglick Jesse Glick made changes -
            Link This issue is duplicated by JENKINS-28276 [ JENKINS-28276 ]
            danielbeck Daniel Beck made changes -
            Link This issue is duplicated by JENKINS-35637 [ JENKINS-35637 ]
            rtyler R. Tyler Croy made changes -
            Workflow JNJira [ 160549 ] JNJira + In-Review [ 185567 ]
            abayer Andrew Bayer made changes -
            Component/s pipeline-general [ 21692 ]
            abayer Andrew Bayer made changes -
            Component/s workflow-plugin [ 18820 ]
            jglick Jesse Glick made changes -
            Component/s workflow-cps-plugin [ 21713 ]
            Component/s pipeline [ 21692 ]
            abayer Andrew Bayer made changes -
            Link This issue is duplicated by JENKINS-38268 [ JENKINS-38268 ]
            abayer Andrew Bayer made changes -
            Link This issue is duplicated by JENKINS-38052 [ JENKINS-38052 ]
            danielbeck Daniel Beck made changes -
            Link This issue is duplicated by JENKINS-37303 [ JENKINS-37303 ]
            recampbell Ryan Campbell made changes -
            Labels groovy kohsuke-plane-project groovy kohsuke-plane-project pipeline-hangs
            idemax Marcelo Filho made changes -
            Link This issue blocks JENKINS-40864 [ JENKINS-40864 ]
            jglick Jesse Glick made changes -
            Link This issue relates to JENKINS-41189 [ JENKINS-41189 ]
            jglick Jesse Glick made changes -
            Link This issue is duplicated by JENKINS-41493 [ JENKINS-41493 ]
            jglick Jesse Glick made changes -
            Link This issue relates to JENKINS-42024 [ JENKINS-42024 ]
            abayer Andrew Bayer made changes -
            Link This issue is duplicated by JENKINS-42769 [ JENKINS-42769 ]
            abayer Andrew Bayer made changes -
            Link This issue is duplicated by JENKINS-42635 [ JENKINS-42635 ]
            fasterfish Marat S made changes -
            Priority Major [ 3 ] Critical [ 2 ]
            abayer Andrew Bayer made changes -
            Assignee Kohsuke Kawaguchi [ kohsuke ] Andrew Bayer [ abayer ]
            abayer Andrew Bayer made changes -
            Remote Link This issue links to "In-progress DGM patching PR (groovy-cps #52) (Web Link)" [ 16508 ]
            jglick Jesse Glick made changes -
            Remote Link This issue links to "workflow-cps PR 124 (Web Link)" [ 16509 ]
            jglick Jesse Glick made changes -
            Assignee Andrew Bayer [ abayer ] Jesse Glick [ jglick ]
            jglick Jesse Glick made changes -
            Status In Progress [ 3 ] In Review [ 10005 ]
            jglick Jesse Glick made changes -
            Resolution Fixed [ 1 ]
            Status In Review [ 10005 ] Resolved [ 5 ]
            jglick Jesse Glick made changes -
            Link This issue is blocked by JENKINS-44578 [ JENKINS-44578 ]
            jglick Jesse Glick made changes -
            Link This issue is duplicated by JENKINS-43519 [ JENKINS-43519 ]
            jglick Jesse Glick made changes -
            Link This issue is blocked by JENKINS-44924 [ JENKINS-44924 ]
            jbochenski Jakub Bochenski made changes -
            Link This issue relates to JENKINS-46747 [ JENKINS-46747 ]
            jbochenski Jakub Bochenski made changes -
            Link This issue relates to JENKINS-46749 [ JENKINS-46749 ]
            jglick Jesse Glick made changes -
            Link This issue is blocked by JENKINS-46703 [ JENKINS-46703 ]
            cloudbees CloudBees Inc. made changes -
            Remote Link This issue links to "CloudBees Internal OSS-1410 (Web Link)" [ 18706 ]
            abayer Andrew Bayer made changes -
            Link This issue is duplicated by JENKINS-40339 [ JENKINS-40339 ]
            dnusbaum Devin Nusbaum made changes -
            Link This issue relates to JENKINS-54982 [ JENKINS-54982 ]

              People

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

                Dates

                Created:
                Updated:
                Resolved: