Merge pull request #995 from DeterminateSystems/declarative-jobsets-plugin
Declarative jobsets: move event handling to a plugin
This commit is contained in:
commit
a14c8ad5f8
17
src/lib/Hydra/Plugin/DeclarativeJobsets.pm
Normal file
17
src/lib/Hydra/Plugin/DeclarativeJobsets.pm
Normal 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;
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue