Cheers, yeah I have it set out like that currently but need to repeat this 
for each and every stage and post section.

Ideally I could set this variable in the 'environment' section so it's 
available throughout the script



On Thursday, 14 September 2017 00:01:47 UTC+1, Andrew Bayer wrote:
>
> Put the rest of your steps inside the {}
>
> A.
>
> On Tue, Sep 12, 2017 at 3:09 PM Russ Cox <[email protected] <javascript:>> 
> wrote:
>
>> Hi, I'm using Jenkins to run a bunch of self service jobs and need to be 
>> able to determine the user id of the person who ran a job.
>>
>> We've been doing this with the scripted pipeline up until now by using 
>> the BuildUser plugin (quite why this isn't just a default exported variable 
>> I don't know, other CI servers do)
>>
>>         wrap([$class: 'BuildUser']) {
>>          sh 'echo "${BUILD_USER}"'
>>          sh 'echo "${BUILD_USER_ID}"'
>>          sh 'echo "${BUILD_USER_EMAIL}"'
>>         }
>>
>> I can run the following within a step but the variable isn't available to 
>> subsequent steps.
>>
>>       steps {
>>         wrap([$class: 'BuildUser']) {
>>          sh 'echo "${BUILD_USER}"'
>>          sh 'echo "${BUILD_USER_ID}"'
>>          sh 'echo "${BUILD_USER_EMAIL}"'
>>         }
>>         echo "${USER_ID}"
>>
>> Seems like there must be a way round this but can't find an answer in 
>> documentation or google, any help would be great.
>>
>> -- 
>> 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/4be2dcc6-fc13-4e70-bbd4-96556f3d27d0%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/4be2dcc6-fc13-4e70-bbd4-96556f3d27d0%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/775cf718-f444-4c7d-83c3-44f8966faff5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to