-
Type:
Bug
-
Resolution: Not A Defect
-
Priority:
Minor
-
Component/s: pipeline-build-step-plugin
-
None
I wonder how to accomplish dynamic node names or passing any variables to branches in general?
How to pass variable nodeName into closure ? Please consider following code:
def getBranches(def config){
def branches = [:]
for (node in config){
def nodeName = node.get('node')
def udid = node.get('udid')
echo "node: ${nodeName}"
echo "udid: ${udid}"
branches[nodeName] = {
node(nodeName){
echo "1"
echo "${udid}"
}
}
}
return branches
}
stage('My awesome parallel jobs stage'){
node {
def config = getConfig()
def branches = getBranches(config)
parallel branches
}
}