Thanks @Craig, works perfect!

On Tuesday, May 24, 2016 at 4:03:06 PM UTC-7, Craig Rodrigues wrote:
>
> Matt,
>
> Take a look at: 
> https://groups.google.com/d/msg/jenkinsci-users/P7VMQQuMdsY/bHfBDSn9GgAJ
> and see if it helps.
>
> It took me a long time to figure that out, and it was not obvious to me.
>
> --
> Craig
>
>
> On Tue, May 24, 2016 at 3:34 PM, Matt Evans <[email protected] 
> <javascript:>> wrote:
>
>> 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] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-users/fa738334-df6c-48a6-987f-cf4299200cc8%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/fa738334-df6c-48a6-987f-cf4299200cc8%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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/ddebd5e3-bb17-4605-a6a1-610a90fbaed4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to