-
Bug
-
Resolution: Won't Fix
-
Minor
-
None
-
Jenkins 2.10
JOB DSL 1.48
I am trying to execute a grrovy DSL script as part of a pipeline. The basic structure is as follows
step([ $class: 'ExecuteDslScripts', scriptLocation: [targets: ['myseed.groovy'].join('\n')], ])
The pipeline job contains a string parameter named as gitProject. Trying to access it's value by using "${gitProject}" from within the groovy DSL results in an error that says gitProject is not defined. Trying to wrap the step as follows doesn't help either
withEnv(["gitProject=$gitProject"]) { sh 'set' step([ $class: 'ExecuteDslScripts', scriptLocation: [targets: ['myseed.groovy'].join('\n')], ]) }
My guess is that the withEnv approach would not work as job DSLs do not have access to all environment variables; only whitelisted ones and build parameters make it. So I guess some change needs to be done to the plugin to ensure that it is able to access build parameters from within pipelines as well
- is duplicated by
-
JENKINS-40102 job dsl does not respect pipeline withEnv
- Closed
-
JENKINS-41099 Add binding to the jobDsl
- Closed
- is related to
-
JENKINS-44128 Pass custom parameters to job-dsl via pipeline step jobDsl
- Closed