Browse Source

Issue #46 - Add post-release tasks on rollback

1.0
Andrés Montañez 11 years ago
parent
commit
5d03d945cb
  1. 23
      Mage/Task/BuiltIn/Releases/RollbackTask.php
  2. 6
      docs/example-config/.mage/config/environment/staging.yml

23
Mage/Task/BuiltIn/Releases/RollbackTask.php

@ -109,6 +109,7 @@ class RollbackTask extends AbstractTask implements IsReleaseAware
$tasksToRun = $this->getConfig()->getTasks();
$this->getConfig()->setReleaseId($releaseId);
// Run Deploy Tasks
foreach ($tasksToRun as $taskData) {
$task = Factory::get($taskData, $this->getConfig(), true, self::STAGE_DEPLOY);
$task->init();
@ -151,6 +152,28 @@ class RollbackTask extends AbstractTask implements IsReleaseAware
Console::output('<red>FAIL</red>', 0);
}
// Run Post Release Tasks
$tasksToRun = $this->getConfig()->getTasks(AbstractTask::STAGE_POST_DEPLOY);
foreach ($tasksToRun as $taskData) {
$task = Factory::get($taskData, $this->getConfig(), true, self::STAGE_POST_DEPLOY);
$task->init();
Console::output('Running <purple>' . $task->getName() . '</purple> ... ', 2, false);
if ($task instanceOf RollbackAware) {
$tasks++;
$result = $task->run();
if ($result == true) {
Console::output('<green>OK</green>', 0);
$completedTasks++;
} else {
Console::output('<red>FAIL</red>', 0);
}
} else {
Console::output('<yellow>SKIPPED</yellow>', 0);
}
}
if ($completedTasks == $tasks) {
$tasksColor = 'green';
} else {

6
docs/example-config/.mage/config/environment/staging.yml

@ -12,15 +12,15 @@ releases:
directory: releases
hosts:
- localhost
# - dbserver
- 127.0.0.1
tasks:
pre-deploy:
- sampleTask
# - sampleTask
# - failTask
- scm/update
on-deploy:
- privileges
- sampleTask
# - sampleTask
- sampleTaskRollbackAware
- taskWithParameters:
booleanOption: true

Loading…
Cancel
Save