Put the rest of your steps inside the {}
A.
On Tue, Sep 12, 2017 at 3:09 PM Russ Cox <[email protected]> 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].
> 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/CAPbPdOZoqM0esMVZnOMz4nPwXa95Yr8NnfFqvCb5LprHeTxsBg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.