pipeline : Get the username from the last commit

31 views
Skip to first unread message

Jonathan Hodgson

unread,
Nov 29, 2016, 8:54:45 AM11/29/16
to Jenkins Users
Hi,

When a build happens after a push to the repository, I would like to email the person who did the push (or the last commit, which usually amounts to the same thing) with the result.

Is there a way to get the user's name and email?

Daniel Beck

unread,
Nov 29, 2016, 9:25:00 AM11/29/16
to jenkins...@googlegroups.com

> On 29.11.2016, at 14:54, Jonathan Hodgson <j.r.h...@gmail.com> wrote:
>
> When a build happens after a push to the repository, I would like to email the person who did the push (or the last commit, which usually amounts to the same thing) with the result.
>
> Is there a way to get the user's name and email?

Email-ext plugin has an emailextrecipients pipeline statement that lets you send an email to the 'culprits':

https://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin#Email-extplugin-PipelineExamples

---

Alternatively, adapt this script to extract the Git committer email address:

https://github.com/jenkinsci/pipeline-examples/blob/master/pipeline-examples/gitcommit/gitcommit.groovy


Reply all
Reply to author
Forward
0 new messages