javagroovyhudsonhudson-plugins

how do I get the username of the user who started a build in hudson


I'm using the groovy post build plugin.

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

I'd like to access the username of the user who started the build. What is the correct variable for this?


Solution

  • I'm running something that looks like this:

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