Upgrades and upgrade tests take versions of the form release/stable instead of stable_release:

- Refactor common and gce/upgrade.sh to use arbitrary published releases
- Update hack/get-build to use cluster/common code
- Use hack/get-build.sh in cluster upgrade test logic
This commit is contained in:
Isaac Hollander McCreery
2015-10-12 16:11:12 -07:00
parent e929977ff3
commit 60c316b54a
8 changed files with 120 additions and 141 deletions

View File

@@ -24,6 +24,13 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
DEFAULT_KUBECONFIG="${HOME}/.kube/config"
# KUBE_VERSION_REGEX matches things like "v1.2.3"
KUBE_VERSION_REGEX="^v(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
# KUBE_CI_VERSION_REGEX matches things like "v1.2.3-alpha.4.56+abcdefg"
KUBE_CI_VERSION_REGEX="^v(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)-(.*)$"
# Generate kubeconfig data for the created cluster.
# Assumed vars:
# KUBE_USER
@@ -224,23 +231,20 @@ function detect-master-from-kubeconfig() {
fi
}
# Sets KUBE_VERSION variable to the version passed in as an argument, or if argument is
# latest_stable, latest_release, or latest_ci fetches and sets the corresponding version number
# Sets KUBE_VERSION variable to the proper version number (e.g. "v1.0.6",
# "v1.2.0-alpha.1.881+376438b69c7612") or a version' publication of the form
# <bucket>/<version> (e.g. "release/stable",' "ci/latest-1").
#
# See the docs on getting builds for more information about version
# publication.
#
# Args:
# $1 version string from command line
# Vars set:
# KUBE_VERSION
function set_binary_version() {
if [[ "${1}" == "latest_stable" ]]; then
KUBE_VERSION=$(gsutil cat gs://kubernetes-release/release/stable.txt)
echo "Using latest stable version: ${KUBE_VERSION}" >&2
elif [[ "${1}" == "latest_release" ]]; then
KUBE_VERSION=$(gsutil cat gs://kubernetes-release/release/latest.txt)
echo "Using latest release version: ${KUBE_VERSION}" >&2
elif [[ "${1}" == "latest_ci" ]]; then
KUBE_VERSION=$(gsutil cat gs://kubernetes-release/ci/latest.txt)
echo "Using latest ci version: ${KUBE_VERSION}" >&2
if [[ "${1}" =~ "/" ]]; then
KUBE_VERSION=$(gsutil cat gs://kubernetes-release/${1}.txt)
else
KUBE_VERSION=${1}
fi
@@ -251,8 +255,11 @@ function set_binary_version() {
# use local dev binaries.
#
# Assumed vars:
# PROJECT
# KUBE_VERSION_REGEX
# KUBE_CI_VERSION_REGEX
# Vars set:
# KUBE_TAR_URL
# KUBE_TAR_HASH
# SERVER_BINARY_TAR_URL
# SERVER_BINARY_TAR_HASH
# SALT_TAR_URL
@@ -262,15 +269,20 @@ function tars_from_version() {
find-release-tars
upload-server-tars
elif [[ ${KUBE_VERSION} =~ ${KUBE_VERSION_REGEX} ]]; then
KUBE_TAR_URL="https://storage.googleapis.com/kubernetes-release/release/${KUBE_VERSION}/kubernetes.tar.gz"
SERVER_BINARY_TAR_URL="https://storage.googleapis.com/kubernetes-release/release/${KUBE_VERSION}/kubernetes-server-linux-amd64.tar.gz"
SALT_TAR_URL="https://storage.googleapis.com/kubernetes-release/release/${KUBE_VERSION}/kubernetes-salt.tar.gz"
elif [[ ${KUBE_VERSION} =~ ${KUBE_CI_VERSION_REGEX} ]]; then
KUBE_TAR_URL="https://storage.googleapis.com/kubernetes-release/ci/${KUBE_VERSION}/kubernetes.tar.gz"
SERVER_BINARY_TAR_URL="https://storage.googleapis.com/kubernetes-release/ci/${KUBE_VERSION}/kubernetes-server-linux-amd64.tar.gz"
SALT_TAR_URL="https://storage.googleapis.com/kubernetes-release/ci/${KUBE_VERSION}/kubernetes-salt.tar.gz"
else
echo "Version doesn't match regexp" >&2
exit 1
fi
until KUBE_TAR_HASH=$(curl --fail --silent "${KUBE_TAR_URL}.sha1"); do
echo "Failure trying to curl release .sha1"
done
until SERVER_BINARY_TAR_HASH=$(curl --fail --silent "${SERVER_BINARY_TAR_URL}.sha1"); do
echo "Failure trying to curl release .sha1"
done
@@ -278,6 +290,10 @@ function tars_from_version() {
echo "Failure trying to curl Salt tar .sha1"
done
if ! curl -Ss --range 0-1 "${KUBE_TAR_URL}" >&/dev/null; then
echo "Can't find release at ${KUBE_TAR_URL}" >&2
exit 1
fi
if ! curl -Ss --range 0-1 "${SERVER_BINARY_TAR_URL}" >&/dev/null; then
echo "Can't find release at ${SERVER_BINARY_TAR_URL}" >&2
exit 1