问题
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
}
回答1:
Installing "Pipeline Build Step Plugin" resolved this issue
https://wiki.jenkins-ci.org/display/JENKINS/Pipeline+Build+Step+Plugin
来源:https://stackoverflow.com/questions/42118619/jenkins-pipeline-no-such-dsl-method-build