Daniel Hernández Daniel Hernández - 1 year ago 109
Groovy Question

Get user name from Jenkins Workflow (Pipeline) Plugin

I am using the Pipeline plugin in Jenkins by Clouldbees (the name was Workflow plugin before), I am trying to get the user name in the Groovy script but I am not able to achieve it.

stage 'checkout svn'

node('master') {
// Get the user name logged in Jenkins

Answer Source

Did you try installing the Build User Vars plugin? If so, you should be able to run

node {
  wrap([$class: 'BuildUser']) {
    def user = env.BUILD_USER_ID

or similar.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download