Add retries to ansible galaxy install for all envs
Galaxy install often fails in CI, scuppering an otherwise good run. Change-Id: I3d02afe33cdf32b1d285bd4bdc4a8074883113ca
This commit is contained in:
parent
7115972232
commit
7ed7b27bc4
@ -473,7 +473,7 @@ function tenks_deploy {
|
||||
install_venv "${TENKS_VENV_PATH}" "$tenks_path"
|
||||
source ${TENKS_VENV_PATH:-$HOME/tenks-test-venv}/bin/activate
|
||||
|
||||
ansible-galaxy install \
|
||||
${KAYOBE_SOURCE_PATH}/tools/ansible-galaxy-retried.sh install \
|
||||
--role-file="$tenks_path/requirements.yml" \
|
||||
--roles-path="$tenks_path/ansible/roles/"
|
||||
|
||||
|
15
tools/ansible-galaxy-retried.sh
Executable file
15
tools/ansible-galaxy-retried.sh
Executable file
@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
GALAXY_RETRIES=${GALAXY_RETRIES:-3}
|
||||
|
||||
for i in $(seq 1 $GALAXY_RETRIES); do
|
||||
if ansible-galaxy "${@}"; then
|
||||
exit 0
|
||||
fi
|
||||
echo "Ansible Galaxy command failed. Retrying"
|
||||
done
|
||||
|
||||
echo "Failed to execute: ansible-galaxy ${@}"
|
||||
exit 1
|
6
tox.ini
6
tox.ini
@ -51,7 +51,7 @@ usedevelop = True
|
||||
sitepackages = True
|
||||
commands =
|
||||
# Install ansible role dependencies from Galaxy.
|
||||
ansible-galaxy install \
|
||||
{toxinidir}/tools/ansible-galaxy-retried.sh install \
|
||||
-r {toxinidir}/requirements.yml \
|
||||
-p {toxinidir}/ansible/roles
|
||||
{toxinidir}/tools/test-ansible.sh {posargs}
|
||||
@ -67,7 +67,7 @@ whitelist_externals =
|
||||
bash
|
||||
commands =
|
||||
# Install ansible role dependencies from Galaxy.
|
||||
ansible-galaxy install \
|
||||
{toxinidir}/tools/ansible-galaxy-retried.sh install \
|
||||
-r {toxinidir}/requirements.yml \
|
||||
-p {toxinidir}/ansible/roles
|
||||
bash -c "source {envdir}/bin/activate && {toxinidir}/tools/test-molecule.sh {posargs}"
|
||||
@ -80,7 +80,7 @@ commands = ansible-lint ansible/*.yaml
|
||||
basepython = python3
|
||||
commands =
|
||||
# Install ansible role dependencies from Galaxy.
|
||||
ansible-galaxy install \
|
||||
{toxinidir}/tools/ansible-galaxy-retried.sh install \
|
||||
-r {toxinidir}/requirements.yml \
|
||||
-p {toxinidir}/ansible/roles
|
||||
# Perform an Ansible syntax check. Skip some playbooks which require extra
|
||||
|
Loading…
Reference in New Issue
Block a user