我需要从管道触发Jenkins Job DSL(具体来说,我需要模仿从工作空间和行为中读取定义文件),但作业dsl插件还没有在管道步骤列表中。我怎样才能做到这一点?
答案 0 :(得分:6)
Job DSL维基显示如何将作业DSL作为管道步骤运行:https://github.com/jenkinsci/job-dsl-plugin/wiki/User-Power-Moves#use-job-dsl-in-pipeline-scripts
node {
jobDsl scriptText: 'job("example-2")'
jobDsl targets: ['jobs/projectA/*.groovy', 'jobs/common.groovy'].join('\n'),
removedJobAction: 'DELETE',
removedViewAction: 'DELETE',
lookupStrategy: 'SEED_JOB',
additionalClasspath: ['libA.jar', 'libB.jar'].join('\n')
}