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

@ -15,5 +15,7 @@ with pkgs;
perlPackages.IOCompressBzip2
perlPackages.Readonly
perlPackages.DBDPg
perlPackages.EmailSend
perlPackages.EmailSender
perlPackages.EmailSimpleCreator
perlPackages.ModulePluggable
]

View file

@ -123,3 +123,9 @@
* Delete all scheduled builds that are not already building:
delete from builds where finished = 0 and not exists (select 1 from buildschedulinginfo s where s.id = builds.id and busy = 1);
* Installing deps.nix in a profile for testing:
$ nix-env -p /nix/var/nix/profiles/per-user/eelco/hydra-deps -f deps.nix -i \* --arg pkgs 'import /home/eelco/Dev/nixpkgs {}'

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