-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
workflow-cps-plugin 2.39
Running this Jenkinsfile
def lines2 = [['Quick', 'Brown']] echo "Literal toString():" + lines2 def result2 = '' lines2.each{ result2 += it } echo "Literal each: " + result2 @NonCPS def test(){ def lines = ['Quick Brown'].collect{ it.split('\\s+') } echo "NonCps toString()" + lines def result = '' lines.each{ result += it } echo "NonCps each: " + result } test() def lines = ['Quick Brown'].collect{ it.split('\\s+') } echo "Collect toString():" + lines def result = '' lines.each{ result += it } echo "Collect each: " + result
Results in
[Pipeline] echo Literal toString():[[Quick, Brown]] [Pipeline] echo Literal each: [Quick, Brown] [Pipeline] echo NonCps toString()[[Quick, Brown]] [Pipeline] echo NonCps each: [Quick, Brown] [Pipeline] echo Collect toString():[[Quick, Brown]] [Pipeline] echo Collect each: Quick [Pipeline] End of Pipeline Finished: SUCCESS
As you can see calling .each on a literal list works correctly, but calling it on a result of .collect still fails like JENKINS-26481
- relates to
-
JENKINS-26481 Mishandling of binary methods accepting Closure
- Resolved