From 802bde54e087fab9394e00134753a40e5cc89b0c Mon Sep 17 00:00:00 2001 From: zimbatm Date: Wed, 17 Nov 2021 23:11:38 +0100 Subject: [PATCH] install-nix.sh: retry curl 5 times If fetching the install script fails, don't keep the CI running forever. --- lib/install-nix.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/install-nix.sh b/lib/install-nix.sh index ea783dd..904f487 100755 --- a/lib/install-nix.sh +++ b/lib/install-nix.sh @@ -53,9 +53,15 @@ fi echo "installer options: ${installer_options[*]}" # 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 sleep 1 + ((curl_retries--)) + if [[ $curl_retries -le 0 ]]; then + echo "curl retries failed" >&2 + exit 1 + fi done sh "$workdir/install" "${installer_options[@]}"