-
Bug
-
Resolution: Duplicate
-
Major
-
None
-
Workflow 1.1 and Jenkins 1.596
To demonstrate the issue createa new workflow job with the following script:
def str="1:one|2:two|3:three" def i = "2" def opts = str.split(/\|/) def opt = opts.find { o -> o.contains("${i}:") } echo "len: ${opts.length}" echo "opt: ${opt}"
The output of which is
Started by user anonymous Running: Print Message len: 3 Running: Print Message opt: false Running: End of Workflow Finished: SUCCESS
Note the value returned for opt. It appears that the current behavior of find in cps is to return the result of the closure for the first element in the collection.
- duplicates
-
JENKINS-26300 CPS interpreter fails on calls to find(), findAll() default methods
- Resolved
- is related to
-
JENKINS-42635 Passing Closures to NonCPS Library Function give strange results
- Resolved