Plugin/Solution to email diff of changed files on every build failure.

27 views
Skip to first unread message

Jarvis

unread,
Jul 19, 2014, 7:00:25 PM7/19/14
to jenkins...@googlegroups.com
Hey Everyone!

I just joined a team that uses Jenkins for continuous integration and want to know if there is a plugin for the particular problem I'm looking to solve. Let me just start by saying, I'm completely new to Jenkins/Hudson and am actively trying to learn about the system while trying to solve this problem.

My team uses git for version control and as far as I know they have the git plugin for Jenkins already installed. Using some customized email plugin (I think Email-ext), our team lead has Jenkins send out an email when a build fails which includes what unit tests failed. We want to take this a step further.

In addition to what tests failed, is there a way to include the diff of every file that has changed since the last build or commit to the email? We'd like to know exactly who goofed up and where, when a build fails so that even if the original author isn't there at the moment, someone else knows where to look immediately without having to fish through git logs to figure out what went wrong.

I picked up O'Reilly's Jenkins: The Definitive Guide and in the chapter on Notifications, they mentioned that with Email-ext, you can include tokens in your email's body. One such token was ${CHANGES} which is described as "displays the changes made since the last build." Does anyone have any experience with this plugin that knows if this is what I am looking for?

Thanks in advance for any help! :-)

Slide

unread,
Jul 19, 2014, 9:00:19 PM7/19/14
to Jenkins User Mailing List

I am one of the maintainers of the plugin, the changes token will not do a file diff for each change. You would need to use a groovy template to do something like that (and the git plugin api would have to allow you to get to that information). With a groovy temple, the entire object model of Jenkins and its plugins is available to do stuff with. I can't give you the full steps to do what you want, but I can say it is probably doable.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Rafael Pestano

unread,
Sep 10, 2018, 8:15:21 AM9/10/18
to Jenkins Users
Hi folks,

sorry for ressurecting this topic, I just want to add that Last Chages plugin can do what you want but you'll need to use pipeline script, see the example on the plugin documentation: https://wiki.jenkins.io/display/JENKINS/Last+Changes+Plugin#LastChangesPlugin-Sendingthediffasemail

I hope it helps someone searching for the same thing.
Reply all
Reply to author
Forward
0 new messages