从Jenkins Workflow(Pipeline)插件获取登录Jenkins的用户名 [英] Get username logged in Jenkins from Jenkins Workflow (Pipeline) Plugin
本文介绍了从Jenkins Workflow(Pipeline)插件获取登录Jenkins的用户名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Clouldbees的Jenkins中的Pipeline插件(以前的名称是Workflow插件),我试图在Groovy脚本中获取用户名,但是我无法实现.
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
}
推荐答案
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
}
}
或类似的
这篇关于从Jenkins Workflow(Pipeline)插件获取登录Jenkins的用户名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文