Merge pull request #996 from DeterminateSystems/cleanup-build-finished

hydra-notify: move buildFinished query in to the function impl
This commit is contained in:
Graham Christensen 2021-08-12 13:57:13 -04:00 committed by GitHub
commit f30addb9d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -47,7 +47,10 @@ sub buildStarted {
}
sub buildFinished {
my ($build, @deps) = @_;
my ($buildId, @deps) = @_;
my $build = $db->resultset('Builds')->find($buildId)
or die "build $buildId does not exist\n";
my $project = $build->project;
my $jobsetName = $build->get_column('jobset');
@ -107,7 +110,7 @@ for my $build ($db->resultset('Builds')->search(
{
my $buildId = $build->id;
print STDERR "sending notifications for build ${\$buildId}...\n";
buildFinished($build);
buildFinished($build->id);
}
@ -130,9 +133,7 @@ while (!$queued_only) {
buildStarted(int($payload[0]));
} elsif ($channelName eq "build_finished") {
my $buildId = int($payload[0]);
my $build = $db->resultset('Builds')->find($buildId)
or die "build $buildId does not exist\n";
buildFinished($build, @payload[1..$#payload]);
buildFinished($buildId, @payload[1..$#payload]);
} elsif ($channelName eq "step_finished") {
stepFinished(int($payload[0]), int($payload[1]));
}