答案 0 :(得分:0)
您可以添加用户名以建立描述。
currentBuild.description = currentBuild.getBuildCauses().shortDescription[0]
然后您会得到类似波纹管的声音
* #1 Feb 24, 2020 10:00 AM
| Started by user max
如果您只想使用用户
currentBuild.description = currentBuild.getBuildCauses().userId[0]
数据结构为:
[{"_class":"hudson.model.Cause$UserIdCause","shortDescription":"Started by user max","userId":"max","userName":"max"}]
答案 1 :(得分:0)
尝试在“构建后操作->中输入Started by ([\S]+)
设置作业说明的构建说明->“正则表达式”。
答案 2 :(得分:0)
查看、安装和启用作业 https://plugins.jenkins.io/build-user-vars-plugin/
然后使用 BUILD_USER_ID
变量更改构建名称,例如
#${BUILD_NUMBER}: ${GIT_REVISION,length=8} (${GIT_BRANCH}) by ${BUILD_USER_ID}