Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: clean failed releases and add param keep_releases #71

Merged
merged 3 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 3 additions & 0 deletions deploy/defaults/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
clean_before: false
keep_releases: 5
7 changes: 7 additions & 0 deletions deploy/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
release: '{{ now(utc=True, fmt="%Y%m%d%H%M%S") }}'
run_once: true

- name: Clean failed releases
deploy_helper:
path: '{{ path }}'
state: clean
when: clean_before

- name: Initialize the deploy
deploy_helper:
path: '{{ path }}'
Expand All @@ -42,7 +48,7 @@
state: touch
mode: 0644

- name: Download the archive

Check warning on line 51 in deploy/tasks/main.yaml

View workflow job for this annotation

GitHub Actions / Ansible Lint

risky-file-permissions

File permissions unset or incorrect.
get_url:
url: '{{ artifact_url }}'
dest: '{{ deploy_helper.new_release_path }}/archive.tar.gz'
Expand All @@ -50,7 +56,7 @@
Circle-Token: '{{ circleci_token }}'
when: artifact_file is not defined

- name: Copy the archive on the server

Check warning on line 59 in deploy/tasks/main.yaml

View workflow job for this annotation

GitHub Actions / Ansible Lint

risky-file-permissions

File permissions unset or incorrect.
copy:
src: '{{ artifact_file }}'
dest: '{{ deploy_helper.new_release_path }}/archive.tar.gz'
Expand Down Expand Up @@ -85,6 +91,7 @@
path: '{{ deploy_helper.project_path }}'
release: '{{ deploy_helper.new_release }}'
state: finalize
keep_releases: '{{ keep_releases | default(5) }}'

- name: Run after_finalize commands
shell: '{{ item }}' # noqa command-instead-of-shell no-changed-when
Expand Down
Loading