Skip to content

Commit 541e273

Browse files
committed
standardize curl retries in scripts
1 parent 6b0b07b commit 541e273

File tree

9 files changed

+13
-11
lines changed

9 files changed

+13
-11
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ $(KUBECTL): ## Build kubectl from tools folder.
783783
$(HELM): ## Put helm into tools folder.
784784
mkdir -p $(TOOLS_BIN_DIR)
785785
rm -f "$(TOOLS_BIN_DIR)/$(HELM_BIN)*"
786-
curl -fsSL -o $(TOOLS_BIN_DIR)/get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
786+
curl --retry $(CURL_RETRIES) -fsSL -o $(TOOLS_BIN_DIR)/get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
787787
chmod 700 $(TOOLS_BIN_DIR)/get_helm.sh
788788
USE_SUDO=false HELM_INSTALL_DIR=$(TOOLS_BIN_DIR) DESIRED_VERSION=$(HELM_VER) BINARY_NAME=$(HELM_BIN)-$(HELM_VER) $(TOOLS_BIN_DIR)/get_helm.sh
789789
ln -sf $(HELM) $(TOOLS_BIN_DIR)/$(HELM_BIN)

Tiltfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ if "default_registry" in settings:
5050
def deploy_capi():
5151
version = settings.get("capi_version")
5252
capi_uri = "https://github.com/kubernetes-sigs/cluster-api/releases/download/{}/cluster-api-components.yaml".format(version)
53-
cmd = "curl -sSL {} | {} | {} apply -f -".format(capi_uri, envsubst_cmd, kubectl_cmd)
53+
cmd = "curl --retry 3 -sSL {} | {} | {} apply -f -".format(capi_uri, envsubst_cmd, kubectl_cmd)
5454
local(cmd, quiet = True)
5555
if settings.get("extra_args"):
5656
extra_args = settings.get("extra_args")

docs/book/install-and-build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ esac
5757
# we hardcode linux/amd64 since rust uses a different naming scheme
5858
echo "downloading mdBook-${mdBookVersion}-${arch}-${target}.${ext}"
5959
set -x
60-
curl -sL -o /tmp/mdbook.${ext} "https://github.com/rust-lang-nursery/mdBook/releases/download/${mdBookVersion}/mdBook-${mdBookVersion}-${arch}-${target}.${ext}"
60+
curl --retry 3 -sL -o /tmp/mdbook.${ext} "https://github.com/rust-lang-nursery/mdBook/releases/download/${mdBookVersion}/mdBook-${mdBookVersion}-${arch}-${target}.${ext}"
6161
${cmd} /tmp/mdbook.${ext}
6262
chmod +x /tmp/mdbook
6363

hack/create-custom-cloud-provider-config.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ source "${REPO_ROOT}/hack/common-vars.sh"
2626
make --directory="${REPO_ROOT}" "${KUBECTL##*/}"
2727

2828
if [[ -n "${CUSTOM_CLOUD_PROVIDER_CONFIG:-}" ]]; then
29-
curl -sL -o tmp_azure_json "${CUSTOM_CLOUD_PROVIDER_CONFIG}"
29+
curl --retry 3 -sL -o tmp_azure_json "${CUSTOM_CLOUD_PROVIDER_CONFIG}"
3030
envsubst < tmp_azure_json > azure_json
3131
kubectl create secret generic "${CLUSTER_NAME}-control-plane-azure-json" \
3232
--from-file=control-plane-azure.json=azure_json \

hack/ensure-azcli.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ set -o pipefail
2121
if [[ -z "$(command -v az)" ]]; then
2222
echo "installing Azure CLI"
2323
apt-get update && apt-get install -y ca-certificates curl apt-transport-https lsb-release gnupg
24-
curl -sL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | tee /etc/apt/trusted.gpg.d/microsoft.gpg > /dev/null
24+
curl --retry 3 -sL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | tee /etc/apt/trusted.gpg.d/microsoft.gpg > /dev/null
2525
AZ_REPO=$(lsb_release -cs)
2626
echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ ${AZ_REPO} main" | tee /etc/apt/sources.list.d/azure-cli.list
2727
apt-get update && apt-get install -y azure-cli
2828
az login --service-principal -u "${AZURE_CLIENT_ID}" -p "${AZURE_CLIENT_SECRET}" --tenant "${AZURE_TENANT_ID}" > /dev/null
29-
fi
29+
fi

hack/observability/prometheus/fetch-prometheus-resources.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ set -o pipefail
2020

2121
RESOURCES_ROOT=$(dirname "${BASH_SOURCE[0]}")/resources
2222

23-
curl -s https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/master/bundle.yaml > "${RESOURCES_ROOT}/bundle.yaml"
23+
curl --retry 3 -s https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/master/bundle.yaml > "${RESOURCES_ROOT}/bundle.yaml"

hack/util.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,15 @@ set -o errexit
1818
set -o nounset
1919
set -o pipefail
2020

21+
CURL_RETRIES=3
22+
2123
capz::util::get_latest_ci_version() {
2224
release="${1}"
2325
ci_version_url="https://dl.k8s.io/ci/latest-${release}.txt"
24-
if ! curl -fL "${ci_version_url}" > /dev/null; then
26+
if ! curl --retry "${CURL_RETRIES}" -fL "${ci_version_url}" > /dev/null; then
2527
ci_version_url="https://dl.k8s.io/ci/latest.txt"
2628
fi
27-
curl -sSL "${ci_version_url}"
29+
curl --retry "${CURL_RETRIES}" -sSL "${ci_version_url}"
2830
}
2931

3032
capz::util::should_build_kubernetes() {

hack/verify-starlark.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ BUILDIFIER="${SCRIPT_DIR}/tools/bin/buildifier/${VERSION}/buildifier"
5959
if [ ! -f "$BUILDIFIER" ]; then
6060
# install buildifier
6161
cd "${TMP_DIR}" || exit
62-
curl -L "https://github.com/bazelbuild/buildtools/releases/download/${VERSION}/${BINARY}" -o "${TMP_DIR}/buildifier"
62+
curl --retry 3 -L "https://github.com/bazelbuild/buildtools/releases/download/${VERSION}/${BINARY}" -o "${TMP_DIR}/buildifier"
6363
chmod +x "${TMP_DIR}/buildifier"
6464
cd "${ROOT_PATH}"
6565
mkdir -p "$(dirname "$0")/tools/bin/buildifier/${VERSION}"

scripts/ci-entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ setup() {
6464

6565
if [[ "${KUBERNETES_VERSION:-}" =~ "latest" ]]; then
6666
CI_VERSION_URL="https://dl.k8s.io/ci/${KUBERNETES_VERSION}.txt"
67-
export CI_VERSION="${CI_VERSION:-$(curl -sSL "${CI_VERSION_URL}")}"
67+
export CI_VERSION="${CI_VERSION:-$(curl --retry 3 -sSL "${CI_VERSION_URL}")}"
6868
fi
6969
if [[ -n "${CI_VERSION:-}" ]]; then
7070
echo "Using CI_VERSION ${CI_VERSION}"

0 commit comments

Comments
 (0)