Details
-
Type:
Bug
-
Status: Resolved (View Workflow)
-
Priority:
Critical
-
Resolution: Fixed
-
Component/s: workflow-cps-plugin
-
Environment: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.
-
Similar Issues:
-
Epic Link:
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 "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
- blocks
-
JENKINS-40864 Cannot execute Git branch list command in order to populate dynamically a choice pipeline property component
-
- Resolved
-
- depends on
-
JENKINS-34064 Pipeline builds do not run after Groovy 2.x upgrade
-
- Resolved
-
-
JENKINS-27421 Unserializable iterator & entry classes from Java Collections
-
- Resolved
-
- is blocked by
-
JENKINS-44924 pipeline groovy script - Sort a list with custom comparator or closure not sorting
-
- In Progress
-
-
JENKINS-44578 StackOverflowError in CpsTransformer running Declarative on JVMs with small -Xss in workflow-cps 2.33
-
- Resolved
-
-
JENKINS-46703 File.eachFileRecurse(FileType.FILES) and File.eachDirRecurse() only loops for first element
-
- Resolved
-
- is duplicated by
-
JENKINS-38268 Parallel step and closure scope
-
- Resolved
-
-
JENKINS-28276 Map collectEntries closure not behaving correctly
-
- Resolved
-
-
JENKINS-32451 Collection.find returns boolean
-
- Resolved
-
-
JENKINS-37303 .eachDir() iterate only once
-
- Resolved
-
-
JENKINS-38052 Pipeline parallel map not supporting curried closures
-
- Resolved
-
-
JENKINS-42635 Passing Closures to NonCPS Library Function give strange results
-
- Resolved
-
-
JENKINS-42769 NonCPS function returns wrong results!
-
- Resolved
-
-
JENKINS-26699 Workflow plugin silently breaks regular Groovy maps
-
- Resolved
-
-
JENKINS-35637 Pipeline plugin groovy interpreter does not interpret splitEachLine() for all lines
-
- Resolved
-
-
JENKINS-40339 Jenkins parallel pipeline: All subroutine calls in parameter blocks pass arguments from last block
-
- Resolved
-
-
JENKINS-41493 each and collect methods on lists do not work properly
-
- Resolved
-
-
JENKINS-43519 security sandbox should whitelist #eachWithIndex
-
- Resolved
-
- is related to
-
JENKINS-26300 CPS interpreter fails on calls to find(), findAll() default methods
-
- Resolved
-
-
JENKINS-31314 Running asynchronous code inside a @NonCPS method should fail cleanly
-
- Resolved
-
-
JENKINS-28599 Inconsistent behavior of collect
-
- Resolved
-
- relates to
-
JENKINS-46747 Reader.forEachLine only reads first line
-
- Open
-
-
JENKINS-46749 .collect, then .each still results in closure being invoked only for first element
-
- Open
-
-
JENKINS-41189 [Pipeline] Some non-CPS transformable code will not throw errors
-
- Resolved
-
-
JENKINS-54982 Using Java8 Streams evaluates whole expression to Boolean
-
- Open
-
-
JENKINS-42024 Silent error : UnsupportedOperationExceptions are not raised when using each/find
-
- Resolved
-
- links to
Activity
Field | Original Value | New Value |
---|---|---|
Assignee | Jesse Glick [ jglick ] | Kohsuke Kawaguchi [ kohsuke ] |
Link |
This issue is duplicated by |
Link |
This issue is related to |
Remote Link | This issue links to "groovy-cps #8 (Web Link)" [ 12153 ] |
Remote Link | This issue links to "groovy-cps #9 (Web Link)" [ 12154 ] |
Remote Link | This issue links to "groovy-cps #7 (Web Link)" [ 12155 ] |
Status | Open [ 1 ] | In Progress [ 3 ] |
Summary | Closures only executed once in Groovy CPS DSL scripts | Mishandling of binary methods accepting Closure |
Link |
This issue is related to |
Link |
This issue is related to |
Labels | kohsuke-plane-project |
Remote Link | This issue links to "PR 372 (Web Link)" [ 14143 ] |
Link |
This issue depends on |
Link |
This issue depends on |
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" } } ] |
Link |
This issue is duplicated by |
Labels | kohsuke-plane-project | groovy kohsuke-plane-project |
Remote Link | This issue links to "workflow-cps PR 15 (Web Link)" [ 14412 ] |
Remote Link | This issue links to "groovy-cps PR 24 (Web Link)" [ 14413 ] |
Epic Link | JENKINS-35390 [ 171183 ] |
Link |
This issue is duplicated by |
Link |
This issue is duplicated by |
Workflow | JNJira [ 160549 ] | JNJira + In-Review [ 185567 ] |
Component/s | pipeline-general [ 21692 ] |
Component/s | workflow-plugin [ 18820 ] |
Component/s | workflow-cps-plugin [ 21713 ] | |
Component/s | pipeline [ 21692 ] |
Link |
This issue is duplicated by |
Link |
This issue is duplicated by |
Link |
This issue is duplicated by |
Labels | groovy kohsuke-plane-project | groovy kohsuke-plane-project pipeline-hangs |
Link |
This issue blocks |
Link |
This issue relates to |
Link |
This issue is duplicated by |
Link |
This issue relates to |
Link |
This issue is duplicated by |
Link |
This issue is duplicated by |
Priority | Major [ 3 ] | Critical [ 2 ] |
Assignee | Kohsuke Kawaguchi [ kohsuke ] | Andrew Bayer [ abayer ] |
Remote Link | This issue links to "In-progress DGM patching PR (groovy-cps #52) (Web Link)" [ 16508 ] |
Remote Link | This issue links to "workflow-cps PR 124 (Web Link)" [ 16509 ] |
Assignee | Andrew Bayer [ abayer ] | Jesse Glick [ jglick ] |
Status | In Progress [ 3 ] | In Review [ 10005 ] |
Resolution | Fixed [ 1 ] | |
Status | In Review [ 10005 ] | Resolved [ 5 ] |
Link |
This issue is blocked by |
Link |
This issue is duplicated by |
Link | This issue is blocked by JENKINS-44924 [ JENKINS-44924 ] |
Link | This issue relates to JENKINS-46747 [ JENKINS-46747 ] |
Link | This issue relates to JENKINS-46749 [ JENKINS-46749 ] |
Link |
This issue is blocked by |
Remote Link | This issue links to "CloudBees Internal OSS-1410 (Web Link)" [ 18706 ] |
Link |
This issue is duplicated by |
Link | This issue relates to JENKINS-54982 [ JENKINS-54982 ] |