-
Type:
Bug
-
Resolution: Not A Defect
-
Priority:
Minor
-
Component/s: workflow-cps-plugin
-
Environment:Jenkins 2.73.3 and latest pipelines plugings
Consider the following Scripted Pipeline:
def axisPlatform = [
"native",
"cross",
]
def axisBuildType = [
"RelWithDebInfo",
"Debug"
]
tasks = [:]
// build packages
axisPlatform.unique().each { level ->
axisBuildType.each { buildType ->
platform = "${level}-${buildType}"
// build package
tasks["package-${platform}"] = {
node("server2") {
println level
println buildType
println platform
}
}
}
}
stage("1") {
parallel tasks
}
I'm getting:
[package-native-RelWithDebInfo] native [package-native-RelWithDebInfo] RelWithDebInfo [package-native-RelWithDebInfo] cross-Debug [package-native-Debug] native [package-native-Debug] Debug [package-native-Debug] cross-Debug [package-cross-RelWithDebInfo] cross [package-cross-RelWithDebInfo] RelWithDebInfo [package-cross-RelWithDebInfo] cross-Debug [package-cross-Debug] cross [package-cross-Debug] Debug [package-cross-Debug] cross-Debug
It seems that the iterator-variables are copied by value, but the platform-variable is taken by reference.
Is this the expected behavior?