-
Improvement
-
Resolution: Fixed
-
Minor
-
-
job-dsl 1.76
When executing job dsl scripts from configuration-as-code, there should be a way to pass values from the yaml files into the job dsl groovy.
This would be useful in cases where one wishes to generate the same jobs from CasC on multiple masters, with minor variations.
Example:
common_jobs.groovy
job('awesome-job') { description("favorite job of ${SUPERHERO}") }
master_one.yml
jobs:
- providedEnv:
SUPERHERO: 'Wonder Woman'
- file: common_jobs.groovy
master_two.yml
jobs:
- providedEnv:
SUPERHERO: 'Midnighter'
- file: common_jobs.groovy
Alternatively, one could set an environment variable on the host VM/container of Jenkins. Depending on the setup, that can be inconvenient to do. Also, that variable would unnecessarily pollute the environment of every job etc.
- links to