This commit is contained in:
Eelco Dolstra
2009-07-07 16:15:38 +00:00
parent 24a3b39463
commit 3119cc7edc
3 changed files with 40 additions and 1 deletions

View File

@ -5,6 +5,10 @@ use File::Basename;
use File::stat;
use Hydra::Schema;
use Hydra::Helper::Nix;
use Email::Sender::Simple qw(sendmail);
use Email::Sender::Transport::SMTP;
use Email::Simple;
use Email::Simple::Creator;
STDOUT->autoflush();
@ -19,6 +23,28 @@ sub getBuildLog {
}
sub sendEmailNotification {
my ($build) = @_;
print $build, " ", $build->maintainers, "\n";
return if !$build->maintainers;
my $email = Email::Simple->create(
header => [
To => $build->maintainers,
From => "Hydra <e.dolstra\@tudelft.nl>",
Subject => "Build " . $build->id . " finished",
],
body => "Build finished!\n",
);
print $email->as_string;
sendmail($email);
}
sub doBuild {
my ($build) = @_;
@ -256,12 +282,17 @@ sub doBuild {
$build->schedulingInfo->delete;
});
#sendEmailNotification $build;
}
my $buildId = $ARGV[0] or die;
print STDERR "performing build $buildId\n";
#sendEmailNotification $db->resultset('Builds')->find($buildId);
#exit 0;
# Lock the build. If necessary, steal the lock from the parent
# process (runner.pl). This is so that if the runner dies, the
# children (i.e. the build.pl instances) can continue to run and won't