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