install-nix.sh: retry curl 5 times

If fetching the install script fails, don't keep the CI running forever.
This commit is contained in:
zimbatm 2021-11-17 23:11:38 +01:00
parent 21a5164e12
commit 802bde54e0
No known key found for this signature in database
GPG Key ID: 71BAF6D40C1D63D7

View File

@ -53,9 +53,15 @@ fi
echo "installer options: ${installer_options[*]}" echo "installer options: ${installer_options[*]}"
# There is --retry-on-errors, but only newer curl versions support that # There is --retry-on-errors, but only newer curl versions support that
until curl -o "$workdir/install" -v --fail --retry 5 --retry-connrefused -L "${INPUT_INSTALL_URL:-https://nixos.org/nix/install}" curl_retries=5
while ! curl -o "$workdir/install" -v --fail -L "${INPUT_INSTALL_URL:-https://nixos.org/nix/install}"
do do
sleep 1 sleep 1
((curl_retries--))
if [[ $curl_retries -le 0 ]]; then
echo "curl retries failed" >&2
exit 1
fi
done done
sh "$workdir/install" "${installer_options[@]}" sh "$workdir/install" "${installer_options[@]}"