Use Email::MIME instead of Email::Simple
[?]
Nov 19, 2014, 1:44 PM
RX5IIZMT7AKE3SME2TON6HWE7BB2GNYV3KOKL3GLH4J7J2GEOO5ACDependencies
- [2]
KO7BXTVEInclude # of failed builds in Subject - [3]
5M7DKCVIFix typo. - [4]
CG5Y56AEFix uninitialized value warning - [5]
4AKMU4ZBClean up user editing - [6]
SS4TZXNUDistinguish between permanent evaluation errors and transient input errors - [7]
OK4P3AMKRemove the ability to add multiple jobset input alternatives - [8]
N45RZUQ6Reduce I/O in build listings by only fetching required columns - [9]
POPU2ATH* hydra_scheduler: use eval-jobs. - [10]
H7CNGK4O* Log evaluation errors etc. in the DB. - [11]
5SHCWE7X* Prevent repeated evaluation of a jobset with the same inputs. This - [12]
ODNCGFQ5* Improved the navigation bar: don't include all projects (since that - [13]
PCKLFRT5Support push notification of repository changes - [14]
LZVO64YGMerge in the first bits of the API work - [15]
FDE3BJAP* Refactoring. - [16]
HQGXL4MXAdd validation for project and jobset names - [17]
FPK5LF53* Put the project-related actions in a separate controller. Put the - [18]
LDICTHWYUse Template::Toolkit to generate email messages - [19]
LBNVQXUB* Build the /build stuff in a separate controller. - [20]
BLVQGJ4LUse OO-style plugins - [21]
7DWCXNC7Use the new Nix Perl bindings - [22]
5EQYVRWEAdd a plugin mechanism - [23]
ZDENAYQI* email notification of evaluation errors to project owner (if desired) - [24]
CS7T2XFI - [25]
LMETCA7GCleanup - [26]
Z52T2BC4Support passing a jobset evaluation as an input - [27]
RPTSGIRCEliminate duplicate getPreviousBuild functions - [28]
7UJ5YV4V* Provide a channel for each project containing all the latest - [29]
4IXVBLUIhack to try and prevent too many newlines - [30]
SGRUPSLKOnly send email notification of evaluation error when the evaluation error has changed. Fixes #121. - [31]
NLJJZVHO* Use ->update({...}) properly. - [32]
RWIBJ5L4* Autoflush stdout. - [33]
7ZYBTNJJrevert unmeant previous change which caused errors to stay, even after successful evaluation of jobs - [34]
QDJRQIFFIf multiple dependent builds fail, send a single email - [35]
E6SL7QRUOmit the system type if it's part of the job name - [36]
3XTHEUMP* Implemented the clone feature. - [37]
RXVJFQ5AEvaluator cleanups - [38]
N22GPKYT* Put info about logs / build products in the DB. - [39]
TJK27WSBOpen the DB using Hydra::Model::DB->new - [40]
WQXF2T3Dhydra-evaluator: Don't require $HYDRA_CONFIG - [41]
6BLUKEQ2* Caching of "path" inputs, and fake a revision number for those. - [42]
FHAVPTZ6Hydra/23: added some X-headers with meta info in email notifications, added more descriptive status - [43]
LSZLZHJYAllow users to edit their own settings - [44]
YFPZ46YK* hydra: added variant of build input type, 'build output (same system)' to allow better continous integration in one jobset for multiple system. it makes sure that the system of the build that is passed as input for a job has the same system as the job. - [45]
XJRJ4J7MAdd user registration - [46]
BXW62TGJEmable overriding the email template. - [47]
SRQWC6YERevert "Emable overriding the email template." - [*]
T4LLYESZ* Nix expression for building Hydra. - [*]
6K5PBUUNUse buildEnv to combine Hydra's Perl dependencies - [*]
36ZTCZ4FAdd basic Persona support - [*]
D5QIOJGP* Move everything up one directory. - [*]
OOQ2D3KC* Refactoring: move fetchInput out of hydra_scheduler into a separate - [*]
TULPZ62Y* Perform builds in parallel.
Change contents
- edit in release.nix at line 102
EmailMIME - edit in src/lib/Hydra/Controller/User.pm at line 11
use Hydra::Helper::Email; - replacement in src/lib/Hydra/Controller/User.pm at line 283
sendEmail($c,sendEmail($c->config, - replacement in src/lib/Hydra/Controller/User.pm at line 290
"With regards,\n\nHydra.\n""With regards,\n\nHydra.\n",[] - edit in src/lib/Hydra/Helper/CatalystUtils.pm at line 7
use Email::Simple;use Email::Sender::Simple qw(sendmail);use Email::Sender::Transport::SMTP;use Sys::Hostname::Long; - edit in src/lib/Hydra/Helper/CatalystUtils.pm at line 18
sendEmail - edit in src/lib/Hydra/Helper/CatalystUtils.pm at line 188[6.540]→[6.11460:11462](∅→∅),[6.11460]→[6.11460:11462](∅→∅),[6.11462]→[6.4374:4432](∅→∅),[6.4432]→[6.11462:11463](∅→∅),[6.11462]→[6.11462:11463](∅→∅),[6.11463]→[6.4433:4549](∅→∅),[6.4549]→[6.11463:11464](∅→∅),[6.11463]→[6.11463:11464](∅→∅),[6.11464]→[6.4550:4858](∅→∅)
}sub sendEmail {my ($c, $to, $subject, $body) = @_;my $sender = $c->config->{'notification_sender'} ||(($ENV{'USER'} || "hydra") . "@" . hostname_long);my $email = Email::Simple->create(header => [To => $to,From => "Hydra <$sender>",Subject => $subject],body => $body);print STDERR "Sending email:\n", $email->as_string if $ENV{'HYDRA_MAIL_TEST'};sendmail($email); - file addition: Email.pm[52.339]
package Hydra::Helper::Email;use strict;use Exporter 'import';use Email::Sender::Simple qw(sendmail);use Email::MIME;use File::Slurp;use Sys::Hostname::Long;our @EXPORT = qw(sendEmail getBaseUrl);sub sendEmail {my ($config, $to, $subject, $body, $extraHeaders) = @_;my $url = getBaseUrl($config);my $sender = $config->{'notification_sender'} // (($ENV{'USER'} // "hydra") . "@" . $url);my @headers = (To => $to,From => "Hydra Build Daemon <$sender>",Subject => $subject,'X-Hydra-Instance' => $url, @{$extraHeaders});my $email = Email::MIME->create(attributes => {encoding => 'quoted-printable',charset => 'UTF-8',},header_str => [ @headers ],body_str => $body);print STDERR "sending email:\n", $email->as_string if $ENV{'HYDRA_MAIL_TEST'};if (defined $ENV{'HYDRA_MAIL_SINK'}) {# For testing, redirect all mail to a file.write_file($ENV{'HYDRA_MAIL_SINK'}, { append => 1 }, $email->as_string . "\n");} else {sendmail($email, { from => $sender });}}sub getBaseUrl {my ($config) = @_;return $config->{'base_uri'} // "http://" . hostname_long . ":3000";}1; - edit in src/lib/Hydra/Plugin/EmailNotification.pm at line 3
use utf8; - edit in src/lib/Hydra/Plugin/EmailNotification.pm at line 7
use Email::Sender::Simple qw(sendmail);use Email::Sender::Transport::SMTP;use Email::Simple;use Email::Simple::Creator;use Sys::Hostname::Long;use File::Slurp; - edit in src/lib/Hydra/Plugin/EmailNotification.pm at line 10
use Hydra::Helper::Email; - replacement in src/lib/Hydra/Plugin/EmailNotification.pm at line 16
The status of Hydra job [% showJobName(build) %] [% IF showSystem %](on [% build.system %]) [% END %][% IF prevBuild && build.buildstatus != prevBuild.buildstatus %]has changed from "[% showStatus(prevBuild) %]" to "[% showStatus(build) %]"[% ELSE %]is "[% showStatus(build) %]"[% END %]. For details, seeThe status of Hydra job ‘[% showJobName(build) %]’ [% IF showSystem %](on [% build.system %]) [% END %][% IF prevBuild && build.buildstatus != prevBuild.buildstatus %]has changed from "[% showStatus(prevBuild) %]" to "[% showStatus(build) %]"[% ELSE %]is "[% showStatus(build) %]"[% END %]. For details, see - replacement in src/lib/Hydra/Plugin/EmailNotification.pm at line 99
, baseurl => $self->{config}->{'base_uri'} || "http://localhost:3000", baseurl => getBaseUrl($self->{config}) - replacement in src/lib/Hydra/Plugin/EmailNotification.pm at line 113
my $sender = $self->{config}->{'notification_sender'} ||(($ENV{'USER'} || "hydra") . "@" . hostname_long);my $subject =showStatus($build) . ": Hydra job " . showJobName($build). ($vars->{showSystem} ? " on " . $build->system : ""). (scalar @{$vars->{dependents}} > 0 ? " (and " . scalar @{$vars->{dependents}} . " others)" : ""); - replacement in src/lib/Hydra/Plugin/EmailNotification.pm at line 118[6.3239]→[6.1881:2023](∅→∅),[6.2023]→[6.3909:3910](∅→∅),[6.4032]→[6.3909:3910](∅→∅),[6.3909]→[6.3909:3910](∅→∅),[6.5551]→[6.5551:5709](∅→∅),[6.5709]→[2.0:300](∅→∅),[2.300]→[6.2136:2192](∅→∅),[6.525]→[6.2136:2192](∅→∅),[6.2136]→[6.2136:2192](∅→∅),[6.2192]→[6.5862:6176](∅→∅),[6.5862]→[6.5862:6176](∅→∅),[6.6176]→[6.5627:5628](∅→∅),[6.5627]→[6.5627:5628](∅→∅),[6.5628]→[6.6177:6429](∅→∅)
#my $loglines = 50;#my $logtext = logContents($build->drvpath, $loglines);#$logtext = removeAsciiEscapes($logtext);my $email = Email::Simple->create(header => [To => $to,From => "Hydra Build Daemon <$sender>",Subject =>showStatus($build) . ": Hydra job " . showJobName($build). ($vars->{showSystem} ? " on " . $build->system : ""). (scalar @{$vars->{dependents}} > 0 ? " (and " . scalar @{$vars->{dependents}} . " others)" : ""),'X-Hydra-Instance' => $vars->{baseurl},'X-Hydra-Project' => $build->project->name,'X-Hydra-Jobset' => $build->jobset->name,'X-Hydra-Job' => $build->job->name,'X-Hydra-System' => $build->system],body => "",);$email->body_set($body);if (defined $ENV{'HYDRA_MAIL_SINK'}) {# For testing, redirect all mail to a file.write_file($ENV{'HYDRA_MAIL_SINK'}, { append => 1 }, $email->as_string . "\n");} else {sendmail($email);}sendEmail($self->{config}, $to, $subject, $body,[ 'X-Hydra-Project' => $build->project->name,, 'X-Hydra-Jobset' => $build->jobset->name,, 'X-Hydra-Job' => $build->job->name,, 'X-Hydra-System' => $build->system]); - edit in src/script/hydra-evaluator at line 10
use Hydra::Helper::Email; - edit in src/script/hydra-evaluator at line 13
use Email::Sender::Simple qw(sendmail);use Email::Sender::Transport::SMTP;use Email::Simple;use Email::Simple::Creator;use Sys::Hostname::Long; - edit in src/script/hydra-evaluator at line 15
use Try::Tiny; - edit in src/script/hydra-evaluator at line 18[6.70][54.914]
STDERR->autoflush(1);binmode STDERR, ":encoding(utf8)"; - replacement in src/script/hydra-evaluator at line 51
if (defined $errorMsg && $errorMsg ne ($prevError // "")) {if (defined $errorMsg && $errorMsg ne ($prevError // "") || $ENV{'HYDRA_MAIL_TEST'}) { - edit in src/script/hydra-evaluator at line 60
chomp $errorMsg; - edit in src/script/hydra-evaluator at line 65
my $url = hostname_long; - edit in src/script/hydra-evaluator at line 67[6.753]→[6.1180:1181](∅→∅),[6.1180]→[6.1180:1181](∅→∅),[6.1181]→[6.1317:1370](∅→∅),[6.1370]→[6.1040:1091](∅→∅),[6.805]→[6.1040:1091](∅→∅),[6.1091]→[6.865:866](∅→∅),[6.865]→[6.865:866](∅→∅)
my $sender = $config->{'notification_sender'} ||(($ENV{'USER'} || "hydra") . "@" . $url); - replacement in src/script/hydra-evaluator at line 69
. "This is to let you know that Hydra jobset evaluation of $projectName:$jobsetName ". "This is to let you know that evaluation of the Hydra jobset ‘$projectName:$jobsetName’\n" - replacement in src/script/hydra-evaluator at line 76[6.1148]→[6.1148:1398](∅→∅),[6.1398]→[6.1092:1225](∅→∅),[6.1225]→[6.1371:1382](∅→∅),[6.1237]→[6.51:70](∅→∅),[6.1382]→[6.51:70](∅→∅),[6.1409]→[6.51:70](∅→∅),[6.70]→[6.1432:1439](∅→∅),[6.1432]→[6.1432:1439](∅→∅),[6.1439]→[6.71:100](∅→∅),[6.100]→[6.1439:1440](∅→∅),[6.1439]→[6.1439:1440](∅→∅),[6.1440]→[6.1731:1794](∅→∅),[6.1794]→[6.1496:1519](∅→∅),[6.1496]→[6.1496:1519](∅→∅)
my $email = Email::Simple->create(header => [To => $jobset->project->owner->emailaddress,From => "Hydra Build Daemon <$sender>",Subject => "Hydra $projectName:$jobsetName evaluation error",'X-Hydra-Instance' => $url,'X-Hydra-Project' => $projectName,'X-Hydra-Jobset' => $jobsetName],body => "");$email->body_set($body);print STDERR $email->as_string if $ENV{'HYDRA_MAIL_TEST'};sendmail($email);try {sendEmail($config,$jobset->project->owner->emailaddress,"Hydra $projectName:$jobsetName evaluation error",$body,[ 'X-Hydra-Project' => $projectName, 'X-Hydra-Jobset' => $jobsetName]);} catch {warn "error sending email: $_\n";};