[git plugin] Querying last author's email address for further usage

14 views
Skip to first unread message

Martin Braun

unread,
Oct 9, 2015, 9:03:03 PM10/9/15
to Jenkins Users
In my setup, I have a project that is based off a git repository.
Basically, I use this project to monitor a repository, and if there's
anything new, trigger *another* project which takes in certain
parameters, such as the commit tested, and an email address (for
reports). I would like to have the author's email address of the last
commit on the given branch.

I've tried several ways, but so far no success:

* There's GIT_AUTHOR_EMAIL, but that only uses whatever I set it to, it
does not dynamically read the the author/committer email address from
the changelog. Also, there's an option called 'Use commit author in
changelog', I'm not sure what that actually affects.

* I can read the email address using `git log -1 --pretty=%ae` from the
'Execute Shell' section. But then how can I use it later on? I was
hoping that 'Capture build context information' -> 'Capture Environment
variables' would allow me to export variables from the shell section,
but that doesn't seem to work. I will admit I don't really know what the
BuildContextCapture Plugin does.

* What I can do is trigger the next step remotely from within the
'Execute Shell' field, but that seems wrong and plus, I don't get any
result info in the current project. Still, that's currently the best
solution I have.

Any advice is highly appreciated!

Thanks,
Martin

Martin Braun

unread,
Oct 12, 2015, 5:59:06 PM10/12/15
to Jenkins Users
On 09.10.2015 18:02, Martin Braun wrote:
> * I can read the email address using `git log -1 --pretty=%ae` from the
> 'Execute Shell' section. But then how can I use it later on? I was
> hoping that 'Capture build context information' -> 'Capture Environment
> variables' would allow me to export variables from the shell section,
> but that doesn't seem to work. I will admit I don't really know what the
> BuildContextCapture Plugin does.

I ended up piping the output of said git command into a properties file,
then using that in subsequent triggers by injecting it using the
EnvInject plugin.

M

Reply all
Reply to author
Forward
0 new messages