From f8b80c99c21938d224c7f14082ac5c902b165d38 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Mon, 7 Oct 2013 11:13:37 -0400 Subject: [PATCH] Include who-broke-the-build information in notification emails Signed-off-by: Shea Levy --- src/lib/Hydra/Plugin/EmailNotification.pm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/lib/Hydra/Plugin/EmailNotification.pm b/src/lib/Hydra/Plugin/EmailNotification.pm index 1e484483..87e1fb4b 100644 --- a/src/lib/Hydra/Plugin/EmailNotification.pm +++ b/src/lib/Hydra/Plugin/EmailNotification.pm @@ -29,6 +29,11 @@ The following dependent jobs also failed: [% END -%] [% END -%] + +[% IF nrCommits > 0 -%] +This is likely due to [% IF nrCommits > 1 -%][% nrCommits %] commits by [% END -%][% authorList %]. +[% END -%] + [% IF build.buildstatus == 0 -%] Yay! [% ELSE -%] @@ -74,6 +79,13 @@ sub buildFinished { } } + my ($authors, $nrCommits) = getResponsibleAuthors($build, $self->{plugins}); + my $authorList; + if (scalar keys %{authors} > 0) { + my @x = map { "$_ <$authors->{$_}>" } (sort keys %{$authors}); + $authorList = join(" or ", scalar @x > 1 ? join(", ", @[0..scalar @x - 2]): (), $x[-1]); + } + # Send an email to each interested address. # !!! should use the Template Toolkit here. @@ -89,6 +101,8 @@ sub buildFinished { , baseurl => $self->{config}->{'base_uri'} || "http://localhost:3000" , showJobName => \&showJobName, showStatus => \&showStatus , showSystem => index($build->job->name, $build->system) == -1 + , nrCommits => $nrCommits + , authorList => $authorList }; my $body;