2013-05-08 17:30:30 +02:00
|
|
|
|
package Hydra::Plugin;
|
|
|
|
|
|
2013-05-08 18:34:18 +02:00
|
|
|
|
use strict;
|
2021-08-19 16:36:43 -04:00
|
|
|
|
use warnings;
|
2013-05-08 17:30:30 +02:00
|
|
|
|
use Module::Pluggable
|
|
|
|
|
search_path => "Hydra::Plugin",
|
2013-05-08 18:34:18 +02:00
|
|
|
|
instantiate => 'new';
|
|
|
|
|
|
|
|
|
|
sub new {
|
|
|
|
|
my ($class, %args) = @_;
|
2013-07-02 13:54:18 +02:00
|
|
|
|
my $self = { db => $args{db}, config => $args{config}, plugins => $args{plugins} };
|
2013-05-08 18:34:18 +02:00
|
|
|
|
bless $self, $class;
|
|
|
|
|
return $self;
|
|
|
|
|
}
|
2013-05-08 17:30:30 +02:00
|
|
|
|
|
2019-08-13 17:20:16 +02:00
|
|
|
|
sub isEnabled {
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-02 13:54:18 +02:00
|
|
|
|
sub instantiate {
|
|
|
|
|
my ($class, %args) = @_;
|
|
|
|
|
my $plugins = [];
|
|
|
|
|
$args{plugins} = $plugins;
|
2019-08-13 17:20:16 +02:00
|
|
|
|
push @$plugins, grep { $_->isEnabled } $class->plugins(%args);
|
2013-07-02 13:54:18 +02:00
|
|
|
|
return @$plugins;
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-20 13:27:59 -05:00
|
|
|
|
# To implement behaviors in response to the following events, implement
|
|
|
|
|
# the function in your plugin and it will be executed by hydra-notify.
|
|
|
|
|
#
|
|
|
|
|
# See the tests in t/Event/*.t for arguments, and the documentation for
|
|
|
|
|
# notify events for semantics.
|
|
|
|
|
#
|
|
|
|
|
# # Called when build $build has been queued.
|
|
|
|
|
# sub buildQueued {
|
|
|
|
|
# my ($self, $build) = @_;
|
|
|
|
|
# }
|
2017-05-24 09:45:31 -04:00
|
|
|
|
|
2022-01-10 20:23:48 -05:00
|
|
|
|
# # Called when build $build has been queued again by evaluation $evaluation
|
|
|
|
|
# where $build has not yet finished.
|
|
|
|
|
# sub cachedBuildQueued {
|
|
|
|
|
# my ($self, $evaluation, $build) = @_;
|
|
|
|
|
# }
|
|
|
|
|
|
2022-01-10 20:19:28 -05:00
|
|
|
|
# # Called when build $build is a finished build, and is
|
|
|
|
|
# part evaluation $evaluation
|
|
|
|
|
# sub cachedBuildFinished {
|
|
|
|
|
# my ($self, $evaluation, $build) = @_;
|
|
|
|
|
# }
|
|
|
|
|
|
2021-12-20 13:27:59 -05:00
|
|
|
|
# # Called when build $build has started.
|
|
|
|
|
# sub buildStarted {
|
|
|
|
|
# my ($self, $build) = @_;
|
|
|
|
|
# }
|
2016-03-11 21:48:31 -05:00
|
|
|
|
|
2021-12-20 13:27:59 -05:00
|
|
|
|
# # Called when build $build has finished. If the build failed, then
|
|
|
|
|
# # $dependents is an array ref to a list of builds that have also
|
|
|
|
|
# # failed as a result (i.e. because they depend on $build or a failed
|
|
|
|
|
# # dependeny of $build).
|
|
|
|
|
# sub buildFinished {
|
|
|
|
|
# my ($self, $build, $dependents) = @_;
|
|
|
|
|
# }
|
2013-05-08 17:30:30 +02:00
|
|
|
|
|
2021-12-20 13:27:59 -05:00
|
|
|
|
# # Called when step $step has finished. The build log is stored in the
|
|
|
|
|
# # file $logPath (bzip2-compressed).
|
|
|
|
|
# sub stepFinished {
|
|
|
|
|
# my ($self, $step, $logPath) = @_;
|
|
|
|
|
# }
|
2016-05-27 14:32:48 +02:00
|
|
|
|
|
2013-05-25 15:36:58 -04:00
|
|
|
|
# Called to determine the set of supported input types. The plugin
|
|
|
|
|
# should add these to the $inputTypes hashref, e.g. $inputTypes{'svn'}
|
|
|
|
|
# = 'Subversion checkout'.
|
|
|
|
|
sub supportedInputTypes {
|
|
|
|
|
my ($self, $inputTypes) = @_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Called to fetch an input of type ‘$type’. ‘$value’ is the input
|
|
|
|
|
# location, typically the repository URL.
|
|
|
|
|
sub fetchInput {
|
2013-07-29 15:33:22 -04:00
|
|
|
|
my ($self, $type, $name, $value, $project, $jobset) = @_;
|
2013-05-25 15:36:58 -04:00
|
|
|
|
return undef;
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-02 13:54:18 +02:00
|
|
|
|
# Get the commits to repository ‘$value’ between revisions ‘$rev1’ and
|
|
|
|
|
# ‘$rev2’. Each commit should be a hash ‘{ revision = "..."; author =
|
|
|
|
|
# "..."; email = "..."; }’.
|
|
|
|
|
sub getCommits {
|
|
|
|
|
my ($self, $type, $value, $rev1, $rev2) = @_;
|
|
|
|
|
return [];
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-08 17:30:30 +02:00
|
|
|
|
1;
|