From c3e2ff5e0f31c61eae330a1a41d7a8a83435d9bd Mon Sep 17 00:00:00 2001 From: Paul Bonaud Date: Thu, 6 Aug 2020 11:44:26 +0200 Subject: 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. --- tasks/deploy.yml | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tasks/deploy.yml') diff --git a/tasks/deploy.yml b/tasks/deploy.yml index 8dda5e0..39b5845 100644 --- a/tasks/deploy.yml +++ b/tasks/deploy.yml @@ -85,6 +85,13 @@ - job_result.stderr is defined - job_result.stderr is search("Failed to read git object") +- name: Restart app on clever-cloud when error asks to restart + include_tasks: restart.yml + when: + - not job_result.finished or not job_result.rc == 0 + - job_result.stderr is defined + - job_result.stderr is search("clever restart") + - name: Deploy logs (stdout) debug: var: job_result.stdout_lines -- cgit v1.2.3