https://github.com/jenkinsci/job-dsl-plugin/wiki/JCasC provides the following example of a separate groovy file referenced in the Jenkins Configuration as Code (CasC) syntax.
jobs:
- providedEnv:
SUPERHERO: 'Midnighter'
- file: ./jobdsl/job.groovy
//job.groovy
job('awesome-job') {
description("favorite job of ${SUPERHERO}")
}
I'm looking for a way of defining a few very similar jobs which only differ by a value or two. In the example above, the SUPERHERO
variable looks to be a global, but I need a way to reuse the same groovy include with per-include variables.
Pseudo-code example:
jobs:
- file: ./jobdsl/job.groovy
providedEnv:
SUPERHERO: 'Superman'
- file: ./jobdsl/job.groovy
providedEnv:
SUPERHERO: 'Batman'
Does such a construct exist?