Skip to content

🐛 Fixing failed to install kind for e2e tests #12361

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions hack/ensure-kind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,32 @@ verify_kind_version() {
if ! [ -d "${GOPATH_BIN}" ]; then
mkdir -p "${GOPATH_BIN}"
fi
curl -sLo "${GOPATH_BIN}/kind" "https://github.com/kubernetes-sigs/kind/releases/download/${MINIMUM_KIND_VERSION}/kind-${goos}-${goarch}"

# Download the kind binary with retry logic.
# Retries up to $max_retries times in case of network or server errors.
# The '-f' flag in curl ensures it fails on HTTP errors.
max_retries=5
retry_count=0
until curl -sfLo "${GOPATH_BIN}/kind" "https://github.com/kubernetes-sigs/kind/releases/download/${MINIMUM_KIND_VERSION}/kind-${goos}-${goarch}"; do
retry_count=$((retry_count + 1))
if [ "${retry_count}" -ge "${max_retries}" ]; then
echo "Failed to download kind after ${max_retries} attempts."
return 2
fi
echo "Download of kind failed, retrying (${retry_count}/${max_retries})..."
sleep 3
done

if [ ! -s "${GOPATH_BIN}/kind" ]; then
echo "Downloaded kind binary is missing or empty!"
return 2
fi

chmod +x "${GOPATH_BIN}/kind"
verify_gopath_bin
else
echo "Missing required binary in path: kind"
return 2
else
echo "Missing required binary in path: kind"
return 2
fi
fi

Expand Down