fix the plugin executor so that the status is correctly reported.

This commit is contained in:
Steve B 2013-12-07 13:53:05 +00:00 committed by meadsteve
parent fecfec9fe5
commit ce88f50958
2 changed files with 8 additions and 3 deletions

View file

@ -163,6 +163,7 @@ class Builder implements LoggerAwareInterface, BuildLogger
$this->build->setStarted(new \DateTime());
$this->store->save($this->build);
$this->build->sendStatusPostback();
$this->success = true;
try {
// Set up the build:
@ -170,7 +171,7 @@ class Builder implements LoggerAwareInterface, BuildLogger
// Run the core plugin stages:
foreach (array('setup', 'test', 'complete') as $stage) {
$this->pluginExecutor->executePlugins($this->config, $stage);
$this->success &= $this->pluginExecutor->executePlugins($this->config, $stage);
}
// Failed build? Execute failure plugins and then mark the build as failed.

View file

@ -27,12 +27,14 @@ class Executor
* Execute a the appropriate set of plugins for a given build stage.
* @param array $config PHPCI configuration
* @param string $stage
* @return bool
*/
public function executePlugins(&$config, $stage)
{
$success = true;
// Ignore any stages for which we don't have plugins set:
if (!array_key_exists($stage, $config) || !is_array($config[$stage])) {
return;
return $success;
}
foreach ($config[$stage] as $plugin => $options) {
@ -54,12 +56,14 @@ class Executor
// If we're in the "test" stage and the plugin is not allowed to fail,
// then mark the build as failed:
if ($stage == 'test' && !$options['allow_failures']) {
$this->success = false;
$success = false;
}
$this->logger->logFailure('PLUGIN STATUS: FAILED');
}
}
return $success;
}
/**