aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/test-restart-deploy.yml
diff options
context:
space:
mode:
authorPaul Bonaud <paul.bonaud@fretlink.com>2020-08-06 11:44:26 +0200
committerPaul Bonaud <paul.bonaud@fretlink.com>2020-08-06 15:54:27 +0200
commitc3e2ff5e0f31c61eae330a1a41d7a8a83435d9bd (patch)
treef03e1db57031f574657838a8a15c41319b1c18be /tests/test-restart-deploy.yml
parent315c7f51af48b54719bd793d9d28a4bb396a926a (diff)
downloadansible-clever-c3e2ff5e0f31c61eae330a1a41d7a8a83435d9bd.tar.gz
ansible-clever-c3e2ff5e0f31c61eae330a1a41d7a8a83435d9bd.tar.zst
ansible-clever-c3e2ff5e0f31c61eae330a1a41d7a8a83435d9bd.zip
deploy: try to restart the app when the CLI asks to do it
In some cases (rollback or deployment errored on clever side), clever-tools will fail when calling `clever deploy` because it thinks the currently being deployed commit is already deployed. However in some cases the git pushed commit is not the currently running commit. Leading to a failure in our deployment process. The proposed solution from the clever tools error is to launch `clever restart`. Until we wait for https://github.com/CleverCloud/clever-tools/issues/422 to be fixed, let's do what the error message say: try to restart in case of a deployment failure.
Diffstat (limited to 'tests/test-restart-deploy.yml')
-rw-r--r--tests/test-restart-deploy.yml37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/test-restart-deploy.yml b/tests/test-restart-deploy.yml
new file mode 100644
index 0000000..cbd6cdd
--- /dev/null
+++ b/tests/test-restart-deploy.yml
@@ -0,0 +1,37 @@
1---
2- name: Launch a restart when commit is already up-to-date on clever
3 hosts: localhost
4 remote_user: root
5 pre_tasks:
6 - file:
7 state: absent
8 path: ../clever-commands
9 roles:
10 - role: clever
11 vars:
12 clever_token: 123abc
13 clever_secret: cba321
14 clever_app: app_00000000-0000-0000-0000-000000000000
15 environment:
16 DEPLOY_UP_TO_DATE_APP: true
17 post_tasks:
18 - name: Check stubbed commands
19 shell: "{{ item.cmd }}"
20 ignore_errors: true
21 with_list:
22 - cmd: "grep deploy ../clever-commands"
23 display: "Expected 'clever deploy' command to be called"
24 - cmd: "grep restart ../clever-commands"
25 display: "Expected 'clever restart' command to be called"
26 vars:
27 display: "{{ item.display }}"
28 register: tests_results
29 - name: show results
30 debug:
31 msg:
32 - "failed_results: {{ failed_results }}"
33 - "success_results: {{ success_results }}"
34 failed_when: tests_results is failed
35 vars:
36 failed_results: "{{ tests_results.results | selectattr('failed') | map(attribute='item.display') | list }}"
37 success_results: "{{ tests_results.results | rejectattr('failed') | map(attribute='item.display') | list }}"