Merge pull request #35060 from ixdy/get-kube-binaries-script

Automatic merge from submit-queue

Add option to get-kube-binaries.sh to download and extract tests

A follow-on to #33701.

My goal is to use `cluster/get-kube.sh` and `cluster/get-kube-binaries.sh` instead of the custom download/extraction logic in `e2e-runner.sh`. In addition to simplifying the logic, it'll also allow me to properly test removing the arch-specific binaries from `kubernetes.tar.gz`.

Anyone on @kubernetes/test-infra-maintainers want to take a look?
pull/6/head
Kubernetes Submit Queue 2016-10-18 17:03:44 -07:00 committed by GitHub
commit b844a0722c
2 changed files with 25 additions and 6 deletions

View File

@ -14,7 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# This script downloads and installs the Kubernetes client and server binaries.
# This script downloads and installs the Kubernetes client and server
# (and optionally test) binaries,
# It is intended to be called from an extracted Kubernetes release tarball.
#
# We automatically choose the correct client binaries to download.
@ -30,6 +31,8 @@
# Set KUBERNETES_SKIP_CONFIRM to skip the installation confirmation prompt.
# Set KUBERNETES_RELEASE_URL to choose where to download binaries from.
# (Defaults to https://storage.googleapis.com/kubernetes-release/release).
# Set KUBERNETES_DOWNLOAD_TESTS to additionally download and extract the test
# binaries tarball.
set -o errexit
set -o nounset
@ -130,7 +133,7 @@ function download_tarball() {
# TODO: add actual verification
}
function extract_tarball() {
function extract_arch_tarball() {
local -r tarfile="$1"
local -r platform="$2"
local -r arch="$3"
@ -175,7 +178,16 @@ if [[ ! -x "${KUBE_ROOT}/platforms/${CLIENT_PLATFORM}/${CLIENT_ARCH}/kubectl" ]]
echo "Will download and extract ${CLIENT_TAR} from ${DOWNLOAD_URL_PREFIX}"
fi
if [[ "${DOWNLOAD_CLIENT_TAR}" == false && "${DOWNLOAD_SERVER_TAR}" == false ]]; then
TESTS_TAR="kubernetes-test.tar.gz"
DOWNLOAD_TESTS_TAR=false
if [[ -n "${KUBERNETES_DOWNLOAD_TESTS-}" ]]; then
DOWNLOAD_TESTS_TAR=true
echo "Will download and extract ${TESTS_TAR} from ${DOWNLOAD_URL_PREFIX}"
fi
if [[ "${DOWNLOAD_CLIENT_TAR}" == false && \
"${DOWNLOAD_SERVER_TAR}" == false && \
"${DOWNLOAD_TESTS_TAR}" == false ]]; then
echo "Nothing additional to download."
exit 0
fi
@ -190,10 +202,17 @@ if [[ -z "${KUBERNETES_SKIP_CONFIRM-}" ]]; then
fi
if "${DOWNLOAD_SERVER_TAR}"; then
download_tarball "${KUBE_ROOT}/server" "${SERVER_TAR}"
download_tarball "${KUBE_ROOT}/server" "${SERVER_TAR}"
fi
if "${DOWNLOAD_CLIENT_TAR}"; then
download_tarball "${KUBE_ROOT}/client" "${CLIENT_TAR}"
extract_tarball "${KUBE_ROOT}/client/${CLIENT_TAR}" "${CLIENT_PLATFORM}" "${CLIENT_ARCH}"
extract_arch_tarball "${KUBE_ROOT}/client/${CLIENT_TAR}" "${CLIENT_PLATFORM}" "${CLIENT_ARCH}"
fi
if "${DOWNLOAD_TESTS_TAR}"; then
download_tarball "${KUBE_ROOT}/test" "${TESTS_TAR}"
echo "Extracting ${TESTS_TAR} into ${KUBE_ROOT}"
# Strip leading "kubernetes/"
tar -xzf "${KUBE_ROOT}/test/${TESTS_TAR}" --strip-components 1 -C "${KUBE_ROOT}"
fi

View File

@ -77,7 +77,7 @@ function download_kube_binaries {
}
function create_cluster {
if [[ -n "${KUBERNETES_SKIP_CREATE_CLUSTER}" ]]; then
if [[ -n "${KUBERNETES_SKIP_CREATE_CLUSTER-}" ]]; then
exit 0
fi
echo "Creating a kubernetes on ${KUBERNETES_PROVIDER:-gce}..."