node('master') {
stage('DSL') {
env.FOO = 'BAZ'
withEnv(['FOO=BAR']) {
jobDsl scriptText:'println "${FOO}"'
}
}
}
[Pipeline] node Running on master in /local_home/jenkins/jobs/QuickTests/jobs/dsl_pipe_test/workspace [Pipeline] { [Pipeline] stage [Pipeline] { (DSL) [Pipeline] withEnv [Pipeline] { [Pipeline] step Processing provided DSL script [Pipeline] } [Pipeline] // withEnv [Pipeline] } [Pipeline] // stage [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline ERROR: (script, line 1) No such property: FOO for class: script Possible solutions: jm Finished: FAILURE
How can I get access to environment variables inside the DSL scripts?
--
You received this message because you are subscribed to the Google Groups "job-dsl-plugin" group.
To unsubscribe from this group and stop receiving emails from it, send an email to job-dsl-plugin+unsubscribe@googlegroups.com.
To post to this group, send email to job-dsl-plugin@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/job-dsl-plugin/cf3931d3-e601-41fb-a9b6-ade42a80822e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
node('master') {
stage('DSL') {
env.FOO = 'BAZ'
withEnv(['FOO=BAR']) {
sh 'env'
jobDsl scriptText:'System.getenv().collect{println it.key println it.value}'
}
}
}
To unsubscribe from this group and stop receiving emails from it, send an email to job-dsl-plugi...@googlegroups.com.
To post to this group, send email to job-dsl...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to job-dsl-plugin+unsubscribe@googlegroups.com.
To post to this group, send email to job-dsl-plugin@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/job-dsl-plugin/09bdea6a-a655-43b7-b297-256b065c0012%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/job-dsl-plugin/09bdea6a-a655-43b7-b297-256b065c0012%40googlegroups.com.
--
You received this message because you are subscribed to a topic in the Google Groups "job-dsl-plugin" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/job-dsl-plugin/l19V5sC3Bp4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to job-dsl-plugin+unsubscribe@googlegroups.com.
To post to this group, send email to job-dsl-plugin@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/job-dsl-plugin/CAKqW32CM1eyAf6OtZtNjGf33-5-2hm8xT_51m50uQZCLVn%3DirA%40mail.gmail.com.