From ce88f5095806746d45a40b5b7d144fbc7c12eba9 Mon Sep 17 00:00:00 2001 From: Steve B Date: Sat, 7 Dec 2013 13:53:05 +0000 Subject: [PATCH] fix the plugin executor so that the status is correctly reported. --- PHPCI/Builder.php | 3 ++- PHPCI/Plugin/Util/Executor.php | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) 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; } /**