I have tried many ways to bring variable in scope to a function, can you
please clarify how the following code should be written to bring the
variable "BRANCH_TEST" in scope?
* def BRANCH_TEST = "master"*
* node {*
* deploy()*
* }*
* def deploy(){*
* echo env.BRANCH_TEST*
* }*
Console Output:
[Pipeline] echonull
On Wednesday, April 1, 2015 at 11:32:06 AM UTC-7, Jesse Glick wrote:
>
> On Wednesday, April 1, 2015 at 12:55:37 PM UTC-4, Kent Johnson wrote:
>>
>> I think I could just echo "$env.BUILD_NUMBER" for those who are
>>> wondering. I didn't test doing so though I am sure it would work.
>>
>>
> Either:
>
> echo env.BUILD_NUMBER
>
> or
>
> echo "${env.BUILD_NUMBER}"
>
> (Not sure whether Groovy gives higher precedence to `$` or `.` so play it
> safe and use braces if inside a GString.)
>
> BTW as of the 1.5 release, the live documentation (i.e., Snippet
> Generator) for environment variable handling has been consolidated into the
> help for the new withEnv step, which seemed the most appropriate place for
> it.
>
--
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/fa738334-df6c-48a6-987f-cf4299200cc8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.