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
This commit is contained in:
Markos Chandras 2018-05-08 09:56:42 +01:00
parent 1a98760186
commit ec5210e812
1 changed files with 3 additions and 15 deletions

View File

@ -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