Merge pull request #995 from DeterminateSystems/declarative-jobsets-plugin

Declarative jobsets: move event handling to a plugin
This commit is contained in:
Graham Christensen 2021-08-12 15:56:13 -04:00 committed by GitHub
commit a14c8ad5f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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

@ -53,12 +53,6 @@ sub buildFinished {
my $build = $db->resultset('Builds')->find($buildId) my $build = $db->resultset('Builds')->find($buildId)
or die "build $buildId does not exist\n"; or die "build $buildId does not exist\n";
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)