From ec5210e812e48dac30eca4c188a9d159c5cdacbf Mon Sep 17 00:00:00 2001 From: Markos Chandras Date: Tue, 8 May 2018 09:56:42 +0100 Subject: [PATCH] tasks: repo_clone_git: Retry git-clone on failures The async method of running the git-clone commands has the unfortunate side effect that git-clones are not being retried in case of failures. This breaks deployment on hosts that either have limited network resources or when the remote server implements some sort of rate limiting when they are being hit by many connections from the same host. As such, lets get rid of the async method and use the regular retry/until method to try and recover from the various git-clone failures. Change-Id: Iff0c3c589f5e0a935e0e01cd820083b76d43cc92 --- tasks/repo_clone_git.yml | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/tasks/repo_clone_git.yml b/tasks/repo_clone_git.yml index 9ab01ac..fc92b1d 100644 --- a/tasks/repo_clone_git.yml +++ b/tasks/repo_clone_git.yml @@ -31,7 +31,7 @@ src: "{{ repo_build_release_path }}/requirements.txt" register: slurp_requirements -- name: Clone git repositories asynchronously +- name: Clone git repositories become: yes become_user: "{{ repo_build_service_user_name }}" environment: "{{ global_environment_variables | default({}) }}" @@ -47,18 +47,6 @@ (item['name'] in slurp_requirements.content | b64decode | splitlines) or ((groups[item['project_group']] is defined) and (groups[item['project_group']] | length > 0)) register: _git_clone - async: 1800 - poll: 0 - -- name: Wait for git clones to complete - become: yes - become_user: "{{ repo_build_service_user_name }}" - async_status: - jid: "{{ item['ansible_job_id'] }}" - register: _git_jobs - until: _git_jobs['finished'] | bool + until: _git_clone | success delay: 5 - retries: 360 - with_items: "{{ _git_clone['results'] }}" - when: - - item['ansible_job_id'] is defined + retries: 10