Get user name from Jenkins Workflow (Pipeline) Plu

2019-02-03 02:43发布

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
}

7条回答
Root(大扎)
2楼-- · 2019-02-03 03:40
def jobUserId, jobUserName
//then somewhere
wrap([$class: 'BuildUser']) {
    jobUserId = "${BUILD_USER_ID}"
    jobUserName = "${BUILD_USER}"
}
//then
println("Started By: ${jobUserName}")

We were using this plugin : Build User Vars Plugin. More variables are available.

查看更多
登录 后发表回答