Pipeline Multibranch jobs - Build User Vars Plugin

44 views
Skip to first unread message

Eldad Cohen

unread,
Jan 14, 2019, 3:33:12 PM1/14/19
to Jenkins Users
Hi,

wrap([$class: 'BuildUser']) {
      echo "${BUILD_USER}"
          }
Is it possible with MultiBranch PipeLine ? Got No such property ? 
I just want info what triggered the build ? who did commit ?
Thanks

Carles Capdevila Tejada

unread,
Jan 21, 2019, 6:59:28 AM1/21/19
to Jenkins Users
Hello Eldad,

We have something like this working on our multibranch pipelines:

hudson.model.Cause.UserIdCause userIdCause = (hudson.model.Cause.UserIdCause) pipeline.currentBuild.getCause(hudson.model.Cause.UserIdCause.class)

if(userIdCause) {
   
String userName = userIdCause.getUserName()
   
String userId = userIdCause.getUserId()
}

Bear in mind that script security may block it when trying to run it.

Eldad Cohen

unread,
Jan 27, 2019, 11:48:54 PM1/27/19
to Jenkins Users
Thanks I will give it a try
Reply all
Reply to author
Forward
0 new messages