2013-05-08 15:30:30 +00:00
|
|
|
|
package Hydra::Plugin;
|
|
|
|
|
|
2013-05-08 16:34:18 +00:00
|
|
|
|
use strict;
|
2013-05-08 15:30:30 +00:00
|
|
|
|
use Module::Pluggable
|
|
|
|
|
search_path => "Hydra::Plugin",
|
2013-05-08 16:34:18 +00:00
|
|
|
|
instantiate => 'new';
|
|
|
|
|
|
|
|
|
|
sub new {
|
|
|
|
|
my ($class, %args) = @_;
|
2013-07-02 11:54:18 +00:00
|
|
|
|
my $self = { db => $args{db}, config => $args{config}, plugins => $args{plugins} };
|
2013-05-08 16:34:18 +00:00
|
|
|
|
bless $self, $class;
|
|
|
|
|
return $self;
|
|
|
|
|
}
|
2013-05-08 15:30:30 +00:00
|
|
|
|
|
2013-07-02 11:54:18 +00:00
|
|
|
|
sub instantiate {
|
|
|
|
|
my ($class, %args) = @_;
|
|
|
|
|
my $plugins = [];
|
|
|
|
|
$args{plugins} = $plugins;
|
|
|
|
|
push @$plugins, $class->plugins(%args);
|
|
|
|
|
return @$plugins;
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-08 15:30:30 +00: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).
|
2013-05-08 16:34:18 +00:00
|
|
|
|
sub buildFinished {
|
|
|
|
|
my ($self, $build, $dependents) = @_;
|
|
|
|
|
}
|
2013-05-08 15:30:30 +00:00
|
|
|
|
|
2013-05-25 19:36:58 +00: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 19:33:22 +00:00
|
|
|
|
my ($self, $type, $name, $value, $project, $jobset) = @_;
|
2013-05-25 19:36:58 +00:00
|
|
|
|
return undef;
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-02 11:54:18 +00: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 15:30:30 +00:00
|
|
|
|
1;
|