diff --git a/PHPCI/Builder.php b/PHPCI/Builder.php index 2df00bd9..440c0d53 100644 --- a/PHPCI/Builder.php +++ b/PHPCI/Builder.php @@ -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. diff --git a/PHPCI/Plugin/Util/Executor.php b/PHPCI/Plugin/Util/Executor.php index 7ea194eb..5bec1820 100644 --- a/PHPCI/Plugin/Util/Executor.php +++ b/PHPCI/Plugin/Util/Executor.php @@ -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; } /**