Declarative jobsets: move event handling to a plugin

Declarative jobsets were sort of tucked in to the event hanlder
itself. It turned out that it could have been implemented as a
plugin without much trouble.
This commit is contained in:
Graham Christensen 2021-08-12 10:42:56 -04:00
parent 9bce425c33
commit 593af41808
2 changed files with 17 additions and 6 deletions

View file

@ -0,0 +1,17 @@
package Hydra::Plugin::DeclarativeJobsets;
use strict;
use parent 'Hydra::Plugin';
use Hydra::Helper::AddBuilds;
sub buildFinished {
my ($self, $build, $dependents) = @_;
my $project = $build->project;
my $jobsetName = $build->get_column('jobset');
if (length($project->declfile) && $jobsetName eq ".jobsets" && $build->iscurrent) {
handleDeclarativeJobsetBuild($self->{"db"}, $project, $build);
}
}
1;

View file

@ -49,12 +49,6 @@ sub buildStarted {
sub buildFinished { sub buildFinished {
my ($build, @deps) = @_; my ($build, @deps) = @_;
my $project = $build->project;
my $jobsetName = $build->get_column('jobset');
if (length($project->declfile) && $jobsetName eq ".jobsets" && $build->iscurrent) {
handleDeclarativeJobsetBuild($db, $project, $build);
}
my @dependents; my @dependents;
foreach my $id (@deps) { foreach my $id (@deps) {
my $dep = $db->resultset('Builds')->find($id) my $dep = $db->resultset('Builds')->find($id)