aboutsummaryrefslogtreecommitdiffhomepage
path: root/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'tasks')
-rw-r--r--tasks/deploy.yml53
-rw-r--r--tasks/setup.yml1
2 files changed, 25 insertions, 29 deletions
diff --git a/tasks/deploy.yml b/tasks/deploy.yml
index 10c02c4..84ebe73 100644
--- a/tasks/deploy.yml
+++ b/tasks/deploy.yml
@@ -24,15 +24,11 @@
24 tags: 24 tags:
25 - skip_ansible_lint 25 - skip_ansible_lint
26 26
27- name: Deploy to Clever-Cloud 27- name: Push to Clever-Cloud to trigger deployment
28 shell: "clever deploy" 28 command: "git push --force git+ssh://git@push-par-clevercloud-customers.services.clever-cloud.com/{{ clever_app }}.git HEAD:refs/heads/master"
29 args: 29 args:
30 chdir: "{{ clever_app_root }}" 30 chdir: "{{ clever_app_root }}"
31 environment: 31 register: clever_git_push
32 CONFIGURATION_FILE: "{{ clever_login_file }}"
33 register: clever_deploy
34 async: 900 # 15 minutes timeout
35 poll: 30
36 ignore_errors: true 32 ignore_errors: true
37 tags: 33 tags:
38 - skip_ansible_lint 34 - skip_ansible_lint
@@ -42,34 +38,33 @@
42 args: 38 args:
43 chdir: "{{ clever_app_root }}" 39 chdir: "{{ clever_app_root }}"
44 when: 40 when:
45 - clever_deploy is failed 41 - clever_git_push is failed
46 - clever_deploy.stderr is search("Failed to read git object") 42 - clever_git_push.stderr is search("shallow update not allowed")
47 tags: 43 tags:
48 - skip_ansible_lint 44 - skip_ansible_lint
49 45
50- name: Deploy to Clever-Cloud 46- name: Push to Clever-Cloud to trigger deployment
51 shell: "clever deploy" 47 command: "git push --force git+ssh://git@push-par-clevercloud-customers.services.clever-cloud.com/{{ clever_app }}.git HEAD:refs/heads/master"
52 args: 48 args:
53 chdir: "{{ clever_app_root }}" 49 chdir: "{{ clever_app_root }}"
54 environment: 50 when: clever_git_push is failed
55 CONFIGURATION_FILE: "{{ clever_login_file }}"
56 when: clever_deploy is failed
57 register: clever_deploy
58 async: 900 # 15 minutes timeout
59 poll: 30
60 ignore_errors: true
61 tags: 51 tags:
62 - skip_ansible_lint 52 - skip_ansible_lint
63 53
64- name: Return deployment logs 54- name: Watch deployment status
65 debug: 55 command: "clever-wait-deploy.sh '{{ clever_app_root }}'"
66 var: clever_deploy.stdout 56 async: 900
67 57 poll: 0
68- name: Return deployment errors 58 register: long_command
69 debug: 59 environment:
70 var: clever_deploy.stderr 60 CONFIGURATION_FILE: "{{ clever_login_file }}"
71 when: clever_deploy is failed 61 changed_when: False
72 62
73- name: Fail on deployment errors 63# Waits up to 15 minutes
74 fail: "The clever deployment failed! Please check logs above." 64- name: Wait for deployment completion
75 when: clever_deploy is failed 65 async_status:
66 jid: "{{ long_command.ansible_job_id }}"
67 register: job_result
68 until: job_result.finished
69 delay: 30
70 retries: 30
diff --git a/tasks/setup.yml b/tasks/setup.yml
index 33b1ff6..f85a635 100644
--- a/tasks/setup.yml
+++ b/tasks/setup.yml
@@ -26,3 +26,4 @@
26 with_items: 26 with_items:
27 - clever-set-domain.sh 27 - clever-set-domain.sh
28 - clever-set-drain.sh 28 - clever-set-drain.sh
29 - clever-wait-deploy.sh