Merge pull request #95625 from eddiezane/ez/use-gsutil-get-kube

Use gsutil to download kube binaries and release artifacts
This commit is contained in:
Kubernetes Prow Robot 2020-10-16 17:18:13 -07:00 committed by GitHub
commit 22a0a89c40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View File

@ -156,7 +156,10 @@ function download_tarball() {
fi
url="${DOWNLOAD_URL_PREFIX}/${file}"
mkdir -p "${download_path}"
if [[ $(which curl) ]]; then
if [[ $(which gsutil) ]] && [[ "$url" =~ ^https://storage.googleapis.com/.* ]]; then
gsutil cp "${url//'https://storage.googleapis.com/'/'gs://'}" "${download_path}/${file}"
elif [[ $(which curl) ]]; then
# if the url belongs to GCS API we should use oauth2_token in the headers
curl_headers=""
if { [[ "${KUBERNETES_PROVIDER:-gce}" == "gce" ]] || [[ "${KUBERNETES_PROVIDER}" == "gke" ]] ; } &&
@ -167,7 +170,7 @@ function download_tarball() {
elif [[ $(which wget) ]]; then
wget "${url}" -O "${download_path}/${file}"
else
echo "Couldn't find curl or wget. Bailing out." >&2
echo "Couldn't find gsutil, curl, or wget. Bailing out." >&2
exit 4
fi
echo

View File

@ -240,7 +240,9 @@ if [[ -z "${KUBERNETES_SKIP_CONFIRM-}" ]]; then
fi
if "${need_download}"; then
if [[ $(which curl) ]]; then
if [[ $(which gsutil) ]] && [[ "$kubernetes_tar_url" =~ ^https://storage.googleapis.com/.* ]]; then
gsutil cp "${kubernetes_tar_url//'https://storage.googleapis.com/'/'gs://'}" "${file}"
elif [[ $(which curl) ]]; then
# if the url belongs to GCS API we should use oauth2_token in the headers
curl_headers=""
if { [[ "${KUBERNETES_PROVIDER:-gce}" == "gce" ]] || [[ "${KUBERNETES_PROVIDER}" == "gke" ]] ; } &&
@ -251,7 +253,7 @@ if "${need_download}"; then
elif [[ $(which wget) ]]; then
wget "${kubernetes_tar_url}"
else
echo "Couldn't find curl or wget. Bailing out."
echo "Couldn't find gsutil, curl, or wget. Bailing out."
exit 1
fi
fi