Adding a 'broken' and 'fixed' event

This commit is contained in:
Stephen Ball 2015-10-12 17:41:20 +01:00
parent 725ce70ae9
commit e9e80c5179

View file

@ -188,6 +188,13 @@ class Builder implements LoggerAwareInterface
$this->build->sendStatusPostback();
$success = true;
$previous_build = $this->build->getProject()->getLatestBuild();
if ($previous_build) {
$previous_state = $previous_build->getStatus();
} else {
$previous_state = Build::STATUS_NEW;
}
try {
// Set up the build:
$this->setupBuild();
@ -210,9 +217,19 @@ class Builder implements LoggerAwareInterface
if ($success) {
$this->pluginExecutor->executePlugins($this->config, 'success');
if ($previous_state == Build::STATUS_FAILED || $previous_status == Build::STATUS_NEW) {
$this->pluginExecutor->executePlugins($this->config, 'fixed');
}
$this->buildLogger->logSuccess(Lang::get('build_success'));
} else {
$this->pluginExecutor->executePlugins($this->config, 'failure');
if ($previous_state == Build::STATUS_SUCCESS || $previous_status == Build::STATUS_NEW) {
$this->pluginExecutor->executePlugins($this->config, 'broken');
}
$this->buildLogger->logFailure(Lang::get('build_failed'));
}
} catch (\Exception $ex) {