Abort deployment if some deployment tasks failed.

This commit is contained in:
Andrés Montañez 2012-10-24 19:13:47 -02:00
parent b6a0bad25b
commit d5913cbb28
2 changed files with 11 additions and 2 deletions

View file

@ -15,6 +15,7 @@ class Mage_Command_BuiltIn_Deploy
public function run() public function run()
{ {
$this->getConfig()->setReleaseId(date('YmdHis')); $this->getConfig()->setReleaseId(date('YmdHis'));
$failedTasks = 0;
$this->_startTime = time(); $this->_startTime = time();
@ -57,6 +58,8 @@ class Mage_Command_BuiltIn_Deploy
if ($this->_runTask($task)) { if ($this->_runTask($task)) {
$completedTasks++; $completedTasks++;
} else {
$failedTasks++;
} }
} }
@ -71,6 +74,11 @@ class Mage_Command_BuiltIn_Deploy
} }
$this->_endTimeHosts = time(); $this->_endTimeHosts = time();
if ($failedTasks > 0) {
Mage_Console::output('A total of <dark_gray>' . $failedTasks . '</dark_gray> deployment tasks failed: <red>ABORTING</red>', 1, 2);
return;
}
// Releasing // Releasing
if ($this->getConfig()->release('enabled', false) == true) { if ($this->getConfig()->release('enabled', false) == true) {
// Execute the Releases // Execute the Releases
@ -201,7 +209,7 @@ class Mage_Command_BuiltIn_Deploy
} else { } else {
Mage_Console::output('<red>FAIL</red>', 0); Mage_Console::output('<red>FAIL</red>', 0);
$result = true; $result = false;
} }
} catch (Mage_Task_SkipException $e) { } catch (Mage_Task_SkipException $e) {
Mage_Console::output('<yellow>SKIPPED</yellow>', 0); Mage_Console::output('<yellow>SKIPPED</yellow>', 0);

View file

@ -15,7 +15,8 @@ class Task_TaskWithParameters
public function run() public function run()
{ {
throw new Mage_Task_SkipException; //throw new Mage_Task_SkipException;
//return false;
return true; return true;
} }
} }