Iniyaa Karthikeyan
Iniyaa Karthikeyan

Reputation: 91

Jenkins pipeline - No such DSL method 'build'

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
}   

Upvotes: 2

Views: 6402

Answers (1)

Iniyaa Karthikeyan
Iniyaa Karthikeyan

Reputation: 91

Installing "Pipeline Build Step Plugin" resolved this issue

https://wiki.jenkins-ci.org/display/JENKINS/Pipeline+Build+Step+Plugin

Upvotes: 5

Related Questions