I am using below Groovy Script in Jenkins Pipeline to call a Free style job but it ends up with "No such DSL method 'build'" error.
node{
def branches = [:]
List rows =["Test2", "Test1"]
for (int i = 0; i <rows.size(); i++)
{
def index = i
String db = rows[i]
branches["branch${i}"] = {
build job: 'CopyFile', parameters: [[$class:
'StringParameterValue', name: 'DatabaseName', value: db], [$class:
'StringParameterValue', name:'dummy', value: "${index}"]]
}
}
parallel branches
}
WorkflowScript:18
in the stacktrace, e.g. there are at-least 18 lines in the one you run, above script doesn't have 18 lines. Have you tried the script above? – Jon S