c8606c443c
I see failures in my local CI 10-20% of the time on cloning one or two roles, so the test fails to bootstrap. I'm not sure if there is some rate limiting in place on the Openstack git repos, but it seems to fail quite often on a very reliable link. The failure being seen is: Failed to connect to git.openstack.org port 443: No route to host This patch adds retries to the git clone task used to fetch roles to hopefully avoid this failure. Change-Id: I1ea74e3ac4b2d0da88f3155d593eaceb0a205d46
52 lines
1.9 KiB
YAML
52 lines
1.9 KiB
YAML
---
|
|
# Copyright 2016, Rackspace US, Inc.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
- name: Clone the role ansible-role-requirements
|
|
hosts: localhost
|
|
connection: local
|
|
user: root
|
|
tasks:
|
|
- name: Remove target directory if required
|
|
shell: |
|
|
if [[ ! -d "{{ item.path | default(role_path_default) }}/{{ item.name | default(item.src | basename) }}/.git" ]]; then
|
|
rm -rf "{{ item.path | default(role_path_default) }}/{{ item.name | default(item.src | basename) }}"
|
|
fi
|
|
args:
|
|
executable: /bin/bash
|
|
when:
|
|
- item.scm == "git" or item.scm is undefined
|
|
with_items: "{{ roles }}"
|
|
- name: Clone git repos
|
|
git:
|
|
repo: "{{ item.src }}"
|
|
dest: "{{ item.path | default(role_path_default) }}/{{ item.name | default(item.src | basename) }}"
|
|
version: "{{ item.version | default('master') }}"
|
|
refspec: "{{ item.refspec | default(omit) }}"
|
|
update: true
|
|
force: true
|
|
when:
|
|
- item.scm == "git" or item.scm is undefined
|
|
with_items: "{{ roles }}"
|
|
register: git_clone
|
|
until: git_clone | success
|
|
retries: "{{ git_clone_retries }}"
|
|
delay: "{{ git_clone_retry_delay }}"
|
|
vars:
|
|
roles: "{{ lookup('file', role_file) | from_yaml }}"
|
|
role_file: '../ansible-role-requirements.yml'
|
|
role_path_default: '/etc/ansible/roles'
|
|
git_clone_retries: 2
|
|
git_clone_retry_delay: 5
|