Add buildQueued plugin hook

This commit is contained in:
Shea Levy 2017-05-24 09:45:31 -04:00
parent 3d044d2ec2
commit 582c399420
4 changed files with 19 additions and 0 deletions

View file

@ -20,6 +20,11 @@ sub instantiate {
return @$plugins;
}
# Called when build $build has been queued.
sub buildQueued {
my ($self, $build) = @_;
}
# Called when build $build has started.
sub buildStarted {
my ($self, $build) = @_;

View file

@ -69,6 +69,10 @@ sub common {
}
}
sub buildQueued {
common(@_, [], 0);
}
sub buildStarted {
common(@_, [], 0);
}

View file

@ -471,6 +471,7 @@ sub checkBuild {
print STDERR "added build ${\$build->id} (${\$jobset->project->name}:${\$jobset->name}:$jobName)\n";
});
system("hydra-notify build-queued " . $build->id) if defined $buildMap->{$build->id} && $buildMap->{$build->id}->{new};
return $build;
};

View file

@ -42,6 +42,15 @@ if ($cmd eq "build-finished") {
}
}
elsif ($cmd eq "build-queued") {
foreach my $plugin (@plugins) {
eval { $plugin->buildQueued($build); };
if ($@) {
print STDERR "$plugin->buildQueued: $@\n";
}
}
}
elsif ($cmd eq "build-started") {
foreach my $plugin (@plugins) {
eval { $plugin->buildStarted($build); };