Add a plugin mechanism

You can now add plugins to Hydra by writing a module called
Hydra::Plugin::<whatever> and putting it in Perl's search path.  The
only plugin operation currently supported in buildFinished, called
when hydra-build has finished doing a build.

For instance, a Twitter notification plugin would look like this:

  package Hydra::Plugin::TwitterNotification;

  sub buildFinished {
      my ($self, $db, $config, $build, $dependents) = @_;
      print STDERR "tweeting about build ", $build->id, "\n";
      # send tweet...
  }

  1;
This commit is contained in:
Eelco Dolstra
2013-05-08 17:30:30 +02:00
parent f447c7d9db
commit 1d8bb0764b
3 changed files with 191 additions and 159 deletions

14
src/lib/Hydra/Plugin.pm Normal file
View File

@ -0,0 +1,14 @@
package Hydra::Plugin;
use Module::Pluggable
search_path => "Hydra::Plugin",
require => 1;
# $plugin->buildFinished($db, $config, $build, $dependents):
#
# 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).
1;