Reputation: 2144
I need to trigger Jenkins Job DSL from pipeline (specifically, i need to mimic 'read definition file from workspace' behavior), but the job dsl plugin isn't yet on pipeline steps list. How can i achieve that?
Upvotes: 8
Views: 10555
Reputation: 8194
The Job DSL wiki shows how to run Job DSL as a Pipeline step: 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')
}
Upvotes: 12