kayobe/tools/ansible-galaxy-retried.sh
Mark Goddard df00ba22e7 CI: increase Ansible Galaxy retries & add delay
We still see flakiness when downloading content from Ansible Galaxy,
often HTTP 520. This change increases the retries from 3 to 10, and adds
a 5 second delay between attempts.

Change-Id: I0c46e5fcc6979027dc6f1bc5cc49e923a205f654
Related: https://github.com/ansible/galaxy/issues/2429
2021-03-26 17:34:40 +00:00

18 lines
367 B
Bash
Executable File

#!/bin/bash
set -e
GALAXY_RETRIES=${GALAXY_RETRIES:-10}
GALAXY_INTERVAL=${GALAXY_INTERVAL:-5}
for i in $(seq 1 $GALAXY_RETRIES); do
if ansible-galaxy "${@}"; then
exit 0
fi
echo "Ansible Galaxy command failed. Sleeping $GALAXY_INTERVAL seconds before retry"
sleep $GALAXY_INTERVAL
done
echo "Failed to execute: ansible-galaxy ${@}"
exit 1