Include build request user in jenkins mail

After the build is complete, I use the mail-ext-plugin (Jenkins Email Extension Plugin) to send email to specific users. I would like to include the user who launched (requested) the assembly in this mail. - I could not find anything while working with the default Jenkins vars. - I did not find anything in the mailbox. - I tried to create a User User Vars plugin to get $ BUILD_USER

but I can't get it to work.

How to get to $ BUILD_USER, BUILD_REQUESTER, USERNAME or something like that

At the moment I have

$DEFAULT_CONTENT -- {$BUILD_USER} 

resulting in

 zzz test GreenHat - Build # 27 - Still Failing: Check console output.... -- {$BUILD_USER} 

also tried without {}

+7
source share
3 answers

I finally found what I wanted by adding:

 $CAUSE 

or

 ${CAUSE} 

gives

 Started by user Jan Jansen 
+8
source

In your example, {$BUILD_USER} should be ${BUILD_USER} ,
but even so, it will not work unless you install this plugin:

Create Plugin for Custom Vars

It gives you the following variables:

  • BUILD_USER - the full name of the user-created assembly,
  • BUILD_USER_FIRST_NAME - the name of the user who was running,
  • BUILD_USER_LAST_NAME - the name of the user who started creating,
  • BUILD_USER_ID - identifier of the assembly created by the user.

(see plugin page for more details)

+1
source

I understand that I am answering a 4 year old question here, but Google brought me here so others can find this information useful ...

Over the past few years, there have been many changes to the Jenkins Email-ext plugin that affects this issue - for example, in v2.38 (May 24, 2014):

A new extension point for recipient providers (RecipientProvider) has been implemented, this changes the way recipient types are added.

There are no more flags for "Requestor", "Recipients", etc., each of which is provided by the implementation of RecipientProvider

Using the latest version of the plugin, if you want to send an email to the user who called the assembly, you can simply select "Requestor" from the "Send" trigger parameters:

jenkins screenshot

The Recipient List is a hard list that you can also define for a job.

0
source

All Articles