mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 19:01:49 +00:00
Make get-kube.sh work properly the "ci/latest" pointer
This commit is contained in:
parent
3a3dc827e4
commit
b0ae0d074e
@ -41,7 +41,7 @@ set -o pipefail
|
|||||||
|
|
||||||
KUBE_ROOT=$(cd $(dirname "${BASH_SOURCE}")/.. && pwd)
|
KUBE_ROOT=$(cd $(dirname "${BASH_SOURCE}")/.. && pwd)
|
||||||
|
|
||||||
KUBERNETES_RELEASE_URL="${KUBERNETES_RELEASE_URL:-https://storage.googleapis.com/kubernetes-release/release}"
|
KUBERNETES_RELEASE_URL="${KUBERNETES_RELEASE_URL:-https://dl.k8s.io}"
|
||||||
|
|
||||||
function detect_kube_release() {
|
function detect_kube_release() {
|
||||||
if [[ -n "${KUBE_VERSION:-}" ]]; then
|
if [[ -n "${KUBE_VERSION:-}" ]]; then
|
||||||
|
@ -81,7 +81,7 @@ KUBE_CI_VERSION_REGEX="^v(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)-(be
|
|||||||
# KUBE_VERSION
|
# KUBE_VERSION
|
||||||
function set_binary_version() {
|
function set_binary_version() {
|
||||||
if [[ "${1}" =~ "/" ]]; then
|
if [[ "${1}" =~ "/" ]]; then
|
||||||
export KUBE_VERSION=$(curl -fL "https://dl.k8s.io/${1}.txt")
|
export KUBE_VERSION=$(curl -fsSL "https://dl.k8s.io/${1}.txt")
|
||||||
else
|
else
|
||||||
export KUBE_VERSION=${1}
|
export KUBE_VERSION=${1}
|
||||||
fi
|
fi
|
||||||
@ -93,6 +93,8 @@ function download_kube_binaries {
|
|||||||
(
|
(
|
||||||
cd kubernetes
|
cd kubernetes
|
||||||
if [[ -x ./cluster/get-kube-binaries.sh ]]; then
|
if [[ -x ./cluster/get-kube-binaries.sh ]]; then
|
||||||
|
# Make sure to use the same download URL in get-kube-binaries.sh
|
||||||
|
KUBERNETES_RELEASE_URL="${KUBERNETES_RELEASE_URL}" \
|
||||||
./cluster/get-kube-binaries.sh
|
./cluster/get-kube-binaries.sh
|
||||||
fi
|
fi
|
||||||
)
|
)
|
||||||
@ -177,15 +179,15 @@ release=${KUBERNETES_RELEASE:-"release/stable"}
|
|||||||
# Validate Kubernetes release version.
|
# Validate Kubernetes release version.
|
||||||
# Translate a published version <bucket>/<version> (e.g. "release/stable") to version number.
|
# Translate a published version <bucket>/<version> (e.g. "release/stable") to version number.
|
||||||
set_binary_version "${release}"
|
set_binary_version "${release}"
|
||||||
if [[ ${KUBE_VERSION} =~ ${KUBE_RELEASE_VERSION_REGEX} ]]; then
|
if [[ ${KUBE_VERSION} =~ ${KUBE_CI_VERSION_REGEX} ]]; then
|
||||||
release_url="${KUBERNETES_RELEASE_URL}/${KUBE_VERSION}/${file}"
|
# Override KUBERNETES_RELEASE_URL to point to the CI bucket;
|
||||||
elif [[ ${KUBE_VERSION} =~ ${KUBE_CI_VERSION_REGEX} ]]; then
|
# this will be used by get-kube-binaries.sh.
|
||||||
release_url="${KUBERNETES_CI_RELEASE_URL}/${KUBE_VERSION}/${file}"
|
KUBERNETES_RELEASE_URL="${KUBERNETES_CI_RELEASE_URL}"
|
||||||
else
|
elif ! [[ ${KUBE_VERSION} =~ ${KUBE_RELEASE_VERSION_REGEX} ]]; then
|
||||||
echo "Version doesn't match regexp" >&2
|
echo "Version doesn't match regexp" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
kubernetes_tar_url="${KUBERNETES_RELEASE_URL}/${KUBE_VERSION}/${file}"
|
||||||
|
|
||||||
need_download=true
|
need_download=true
|
||||||
if [[ -r "${PWD}/${file}" ]]; then
|
if [[ -r "${PWD}/${file}" ]]; then
|
||||||
@ -199,7 +201,7 @@ fi
|
|||||||
|
|
||||||
if "${need_download}"; then
|
if "${need_download}"; then
|
||||||
echo "Downloading kubernetes release ${KUBE_VERSION}"
|
echo "Downloading kubernetes release ${KUBE_VERSION}"
|
||||||
echo " from ${release_url}"
|
echo " from ${kubernetes_tar_url}"
|
||||||
echo " to ${PWD}/${file}"
|
echo " to ${PWD}/${file}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -225,9 +227,9 @@ fi
|
|||||||
|
|
||||||
if "${need_download}"; then
|
if "${need_download}"; then
|
||||||
if [[ $(which curl) ]]; then
|
if [[ $(which curl) ]]; then
|
||||||
curl -fL --retry 3 --keepalive-time 2 "${release_url}" -o "${file}"
|
curl -fL --retry 3 --keepalive-time 2 "${kubernetes_tar_url}" -o "${file}"
|
||||||
elif [[ $(which wget) ]]; then
|
elif [[ $(which wget) ]]; then
|
||||||
wget "${release_url}"
|
wget "${kubernetes_tar_url}"
|
||||||
else
|
else
|
||||||
echo "Couldn't find curl or wget. Bailing out."
|
echo "Couldn't find curl or wget. Bailing out."
|
||||||
exit 1
|
exit 1
|
||||||
|
Loading…
Reference in New Issue
Block a user