Skip to content

Commit

Permalink
retry ubuntu image download on temp error (#2508)
Browse files Browse the repository at this point in the history
Co-authored-by: kayrus <[email protected]>
  • Loading branch information
k8s-infra-cherrypick-robot and kayrus authored Dec 14, 2023
1 parent d014e5b commit 64d3350
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 64d3350

Please sign in to comment.