At the top of my pipeline (not inside a specific stage) I define an env:
environment {
MYVARRRR = 'sdkfjlsjflsjflsd'}
Now I want to use it in a function call in my post block. I had to do this
to get it to work:
post {
success {
script {
def MYVARRRR = MYVARRRR
myFunction {
someParam = "This is my var: ${MYVARRRR}
}
...
This works fine, but is there a more elegant shorthand for this? Maybe an
annotation that will grab the var from the calling parent or something? Why
do I have to redefine the variable?
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/48b013e7-597a-4bd9-a005-f92d5d858b89%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.