更新时间:2023-12-05 13:56:16
我有类似的东西 - 我想得到触发构建的用户,这是我的代码:
I have something similar - I wanted to get the user who triggered the build, this is my code:
for (cause in bld.getCauses()) {
if (cause instanceof Cause.UserIdCause) {
return cause.getUserName()
}
}
(bld 是 Run 的子类型)
(bld is subtype of Run)
因此,您可以获得构建的原因,并检查它们的类型.
So, you can get the causes for your build, and check for their type.
查看 Cause javadoc 中的不同类型 http://javadoc.jenkins-ci.org/hudson/model/Cause.html
See the different types at Cause javadoc http://javadoc.jenkins-ci.org/hudson/model/Cause.html