How can I get the name of the user who started the build in hudson

I am using the post w build groovy plugin.

http://wiki.hudson-ci.org/display/HUDSON/Groovy+Postbuild+Plugin

I would like to access the name of the user who started the assembly. What is the correct variable for this?

+3
source share
3 answers

I run something like this:

def build = manager.build   // "manager" for Groovy Postbuild plugin, only
def usercause=build.getCause(hudson.model.Cause$UserCause)
def thename=usercause.userName
+6
source

Looking at Javadocs for a variable build, there is a method getCauses(). I think you can start there.

https://hudson.dev.java.net/nonav/javadoc/hudson/model/Run.html#getCauses ()

causes, , . SCM, .

+1

jenkins 1.561

def userName = manager.build.getCause (hudson.model.Cause $ UserIdCause) .userName

0
source

Source: https://habr.com/ru/post/1769552/


All Articles