Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/recipe/deploy/rollback.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ The value of this configuration is autogenerated on access.
## Tasks

### rollback {#rollback}
[Source](https://github.com/deployphp/deployer/blob/master/recipe/deploy/rollback.php#L63)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/deploy/rollback.php#L67)

Rollbacks to the previous release.

Expand Down
2 changes: 2 additions & 0 deletions recipe/deploy/release.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@
$status = "<error>$release</error> (bad)";
} elseif (test("[ -f releases/$release/DIRTY_RELEASE ]")) {
$status = "<error>$release</error> (dirty)";
} elseif (!test("[ -f releases/$release/FINISHED_RELEASE ]")) {
$status = "<error>$release</error> (unfinished)";
} else {
$status = "<info>$release</info>";
}
Expand Down
8 changes: 6 additions & 2 deletions recipe/deploy/rollback.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@
while (isset($releasesBeforeCurrent[0])) {
$candidate = $releasesBeforeCurrent[0];

// Skip all bad releases.
if (test("[ -f {{deploy_path}}/releases/$candidate/BAD_RELEASE ]")) {
if (
// Only consider successful releases.
!test("[ -f {{deploy_path}}/releases/$candidate/FINISHED_RELEASE ]")
// Skip all bad releases (that have previously been rolled back).
|| test("[ -f {{deploy_path}}/releases/$candidate/BAD_RELEASE ]")
) {
array_shift($releasesBeforeCurrent);
continue;
}
Expand Down
2 changes: 2 additions & 0 deletions recipe/deploy/symlink.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@
run("cd {{deploy_path}} && {{bin/symlink}} {{release_path}} {{current_path}}"); // Atomic override symlink.
run("cd {{deploy_path}} && rm release"); // Remove release link.
}

run("echo '{{user}}' > {{release_path}}/FINISHED_RELEASE");
});