Skip to content

Commit

Permalink
Rollback: Clean up old and failed releases
Browse files Browse the repository at this point in the history
  • Loading branch information
tangrufus committed Jan 22, 2020
1 parent 2f722d1 commit 8797751
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions roles/rollback/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
---
- name: Get real path of current symlinked release
command: "readlink {{ project_current_path }}"
args:
chdir: "{{ project_root }}"
register: current_release_readlink_result

- name: Clean up old and failed releases
deploy_helper:
state: clean
path: "{{ project_root }}"
current_path: "{{ project_current_path }}"
release: "{{ current_release_readlink_result.stdout }}"
keep_releases: "{{ project.deploy_keep_releases | default(deploy_keep_releases | default(omit)) }}"

- import_tasks: user-release.yml
when: release is defined

Expand All @@ -15,12 +29,6 @@
msg: "Cannot switch to release at {{ new_release_path }}. It is from an unfinished deploy. You may manually specify a different release using --extra-vars='release=12345678901234'."
when: target.stat.exists | default(False)

- name: Get real path of current symlinked release
command: "readlink {{ project_current_path }}"
args:
chdir: "{{ project_root }}"
register: current_release_real_path

- name: Link 'current' directory to target release
file:
path: "{{ project_root }}/{{ project_current_path }}"
Expand All @@ -29,5 +37,5 @@

- name: Write unfinished file to old symlinked release
file:
path: "{{ current_release_real_path.stdout }}/DEPLOY_UNFINISHED"
path: "{{ current_release_readlink_result.stdout }}/DEPLOY_UNFINISHED"
state: touch

0 comments on commit 8797751

Please sign in to comment.