Jenkins pipeline - No such DSL method 'build'

偶尔善良 提交于 2021-01-25 06:54:22

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!