aboutsummaryrefslogtreecommitdiffhomepage
path: root/tasks
diff options
context:
space:
mode:
authorpaulrbr-fl <43074087+paulrbr-fl@users.noreply.github.com>2019-01-16 16:13:39 +0100
committerGitHub <noreply@github.com>2019-01-16 16:13:39 +0100
commitc11e0231803892dd2bc7749385b480e1d39934d0 (patch)
tree3cf4a1e0e0b53f659e4b38defe037fac6f6ec69a /tasks
parentf23c13859727da0010fb668a9bb9d41ad56203e6 (diff)
parente9b912b42c831d3ca17ed6f0e718f0189ecabfb2 (diff)
downloadansible-clever-c11e0231803892dd2bc7749385b480e1d39934d0.tar.gz
ansible-clever-c11e0231803892dd2bc7749385b480e1d39934d0.tar.zst
ansible-clever-c11e0231803892dd2bc7749385b480e1d39934d0.zip
Merge pull request #33 from paulrbr-fl/successful-deploy-up-to-datev1.16
deploy: check "up-to-date" error to succeeded if last commit is OK
Diffstat (limited to 'tasks')
-rw-r--r--tasks/deploy.yml36
1 files changed, 35 insertions, 1 deletions
diff --git a/tasks/deploy.yml b/tasks/deploy.yml
index 0ed97f8..b394e55 100644
--- a/tasks/deploy.yml
+++ b/tasks/deploy.yml
@@ -80,7 +80,41 @@
80 - clever_deploy is failed 80 - clever_deploy is failed
81 - clever_deploy.stderr is defined 81 - clever_deploy.stderr is defined
82 82
83- shell: clever activity
84 args:
85 chdir: "{{ clever_app_root }}"
86 environment:
87 CONFIGURATION_FILE: "{{ clever_login_file }}"
88 changed_when: false
89 register: clever_activity_result
90
91- debug:
92 var: clever_activity_result.stdout_lines
93
94- shell: git show -q --format=format:%H HEAD
95 args:
96 chdir: "{{ clever_app_root }}"
97 changed_when: false
98 register: current_commit_sha
99
100# ####
101# Expects all configuration to be located in the project's repository.
102# Making a git commit bound to the same *configuration* and *executable* version.
103# ##
104- name: Fail if current commit is not the last deployed one
105 fail:
106 msg: "The clever deployment failed! Please check latest deploy activity logs above."
107 when:
108 - clever_deploy is failed
109 - clever_deploy.stderr is defined
110 - clever_deploy.stderr is search("application is up-to-date")
111 - clever_activity_valid_deploy_keyword in clever_activity_result.stdout_lines[-1]
112 - current_commit_sha.stdout_lines[-1] in clever_activity_result.stdout_lines[-1]
113
83- name: Fail on deployment errors 114- name: Fail on deployment errors
84 fail: 115 fail:
85 msg: "The clever deployment failed! Please check logs above." 116 msg: "The clever deployment failed! Please check logs above."
86 when: clever_deploy is failed 117 when:
118 - clever_deploy is failed
119 - clever_deploy.stderr is defined
120 - clever_deploy.stderr is not search("application is up-to-date")