How can I get the seed job's name inside a Jenksin Job DSL script?

sschuberth picture sschuberth · Sep 16, 2015 · Viewed 8.1k times · Source

I'm using a Freestyle project / job with a Process Job DSLs build step as provided by the Jenkins Job DSL plugin, i.e. that is the "seed" job. How can I, from within the code provided by Use the provided DSL script, get the seed job's name?

I've tried to apply the answers to this question but none of them worked.

Answer

daspilker picture daspilker · Sep 16, 2015

All build variables are injected into the DSL scripts, see Access the Jenkins Environment Variables. The JOB_NAME variable contains the name of the seed job.

println JOB_NAME