Skip to content

Commit

Permalink
[tests] retry ubuntu image download on temp error (#2505)
Browse files Browse the repository at this point in the history
  • Loading branch information
kayrus authored Dec 14, 2023
1 parent 96f2edb commit 2c5c26c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tests/playbooks/roles/install-k3s/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,17 @@
set +x; source openrc admin admin > /dev/null; set -x
openstack image show {{ image_name }} > /dev/null 2>&1
if [[ "$?" != "0" ]]; then
curl -sSL {{ image_url }} -o {{ image_name }}.img
# retry ubuntu image download on failure,
# e.g. "curl: (35) OpenSSL SSL_connect: Connection reset by peer in connection to cloud-images.ubuntu.com:443"
tries=0
until [ "$tries" -ge 5 ]; do
curl -sSL {{ image_url }} -o {{ image_name }}.img && break
echo "Error downloading an image"
((tries++))
sleep 10
done
openstack image create {{ image_name }} --container-format bare --disk-format qcow2 --public --file {{ image_name }}.img
fi
Expand Down

0 comments on commit 2c5c26c

Please sign in to comment.