2015-01-12 21:46:10 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2015-05-01 16:19:44 +00:00
|
|
|
# Copyright 2015 The Kubernetes Authors All rights reserved.
|
2015-01-12 21:46:10 +00:00
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
|
|
|
# kubernetes-e2e-{gce, gke, gke-ci} jobs: This script is triggered by
|
|
|
|
# the kubernetes-build job, or runs every half hour. We abort this job
|
|
|
|
# if it takes more than 75m. As of initial commit, it typically runs
|
|
|
|
# in about half an hour.
|
|
|
|
#
|
|
|
|
# The "Workspace Cleanup Plugin" is installed and in use for this job,
|
|
|
|
# so the ${WORKSPACE} directory (the current directory) is currently
|
|
|
|
# empty.
|
|
|
|
|
|
|
|
set -o errexit
|
|
|
|
set -o nounset
|
|
|
|
set -o pipefail
|
|
|
|
set -o xtrace
|
|
|
|
|
2015-07-15 06:50:09 +00:00
|
|
|
# Join all args with |
|
2015-07-23 11:30:01 +00:00
|
|
|
# Example: join_regex_allow_empty a b "c d" e => a|b|c d|e
|
|
|
|
function join_regex_allow_empty() {
|
2015-07-15 06:50:09 +00:00
|
|
|
local IFS="|"
|
|
|
|
echo "$*"
|
|
|
|
}
|
|
|
|
|
2015-07-23 11:30:01 +00:00
|
|
|
# Join all args with |, butin case of empty result prints "EMPTY\sSET" instead.
|
|
|
|
# Example: join_regex_no_empty a b "c d" e => a|b|c d|e
|
|
|
|
# join_regex_no_empty => EMPTY\sSET
|
|
|
|
function join_regex_no_empty() {
|
|
|
|
local IFS="|"
|
|
|
|
if [ -z "$*" ]; then
|
|
|
|
echo "EMPTY\sSET"
|
|
|
|
else
|
|
|
|
echo "$*"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2015-06-09 22:45:15 +00:00
|
|
|
echo "--------------------------------------------------------------------------------"
|
|
|
|
echo "Initial Environment:"
|
|
|
|
printenv | sort
|
|
|
|
echo "--------------------------------------------------------------------------------"
|
|
|
|
|
2015-02-11 17:45:27 +00:00
|
|
|
if [[ "${CIRCLECI:-}" == "true" ]]; then
|
|
|
|
JOB_NAME="circleci-${CIRCLE_PROJECT_USERNAME}-${CIRCLE_PROJECT_REPONAME}"
|
|
|
|
BUILD_NUMBER=${CIRCLE_BUILD_NUM}
|
|
|
|
WORKSPACE=`pwd`
|
|
|
|
else
|
|
|
|
# Jenkins?
|
|
|
|
export HOME=${WORKSPACE} # Nothing should want Jenkins $HOME
|
2015-01-12 21:46:10 +00:00
|
|
|
fi
|
|
|
|
|
2015-06-09 22:45:15 +00:00
|
|
|
# Additional parameters that are passed to hack/e2e.go
|
|
|
|
E2E_OPT=${E2E_OPT:-""}
|
2015-04-13 09:33:43 +00:00
|
|
|
|
2015-06-09 22:45:15 +00:00
|
|
|
# Set environment variables shared for all of the GCE Jenkins projects.
|
|
|
|
if [[ ${JOB_NAME} =~ ^kubernetes-.*-gce ]]; then
|
|
|
|
KUBERNETES_PROVIDER="gce"
|
2015-07-23 22:22:02 +00:00
|
|
|
: ${E2E_MIN_STARTUP_PODS:="1"}
|
2015-06-09 22:45:15 +00:00
|
|
|
: ${E2E_ZONE:="us-central1-f"}
|
|
|
|
: ${MASTER_SIZE:="n1-standard-2"}
|
|
|
|
: ${MINION_SIZE:="n1-standard-2"}
|
2015-07-13 17:34:55 +00:00
|
|
|
: ${NUM_MINIONS:="3"}
|
2015-04-13 09:33:43 +00:00
|
|
|
fi
|
|
|
|
|
2015-06-09 22:45:15 +00:00
|
|
|
if [[ "${KUBERNETES_PROVIDER}" == "aws" ]]; then
|
|
|
|
if [[ "${PERFORMANCE:-}" == "true" ]]; then
|
|
|
|
: ${MASTER_SIZE:="m3.xlarge"}
|
|
|
|
: ${NUM_MINIONS:="100"}
|
|
|
|
: ${GINKGO_TEST_ARGS:="--ginkgo.focus=\[Performance\ssuite\]"}
|
|
|
|
else
|
|
|
|
: ${MASTER_SIZE:="t2.small"}
|
|
|
|
: ${NUM_MINIONS:="2"}
|
|
|
|
fi
|
|
|
|
fi
|
2015-04-13 09:33:43 +00:00
|
|
|
|
2015-06-09 22:45:15 +00:00
|
|
|
# Specialized tests which should be skipped by default for projects.
|
2015-07-15 06:50:09 +00:00
|
|
|
GCE_DEFAULT_SKIP_TESTS=(
|
|
|
|
"Skipped"
|
|
|
|
"Reboot"
|
|
|
|
"Restart"
|
|
|
|
"Example"
|
|
|
|
)
|
|
|
|
|
2015-06-09 22:45:15 +00:00
|
|
|
# The following tests are known to be flaky, and are thus run only in their own
|
|
|
|
# -flaky- build variants.
|
2015-07-20 09:08:11 +00:00
|
|
|
GCE_FLAKY_TESTS=(
|
|
|
|
"PD\son\stwo\shosts.*remove\sboth"
|
|
|
|
)
|
2015-07-15 06:27:41 +00:00
|
|
|
|
2015-06-09 22:45:15 +00:00
|
|
|
# Tests which are not able to be run in parallel.
|
2015-07-15 06:50:09 +00:00
|
|
|
GCE_PARALLEL_SKIP_TESTS=(
|
|
|
|
${GCE_DEFAULT_SKIP_TESTS[@]:+${GCE_DEFAULT_SKIP_TESTS[@]}}
|
|
|
|
"Etcd"
|
|
|
|
"NetworkingNew"
|
|
|
|
"Nodes\sNetwork"
|
|
|
|
"Nodes\sResize"
|
|
|
|
"MaxPods"
|
2015-07-16 12:38:47 +00:00
|
|
|
"Services.*restarting"
|
2015-07-15 06:50:09 +00:00
|
|
|
"Shell.*services"
|
|
|
|
)
|
|
|
|
|
2015-06-09 22:45:15 +00:00
|
|
|
# Tests which are known to be flaky when run in parallel.
|
2015-07-15 06:50:09 +00:00
|
|
|
GCE_PARALLEL_FLAKY_TESTS=(
|
|
|
|
"Elasticsearch"
|
|
|
|
"PD"
|
|
|
|
"ServiceAccounts"
|
|
|
|
"Service\sendpoints\slatency"
|
|
|
|
"Services.*change\sthe\stype"
|
|
|
|
"Services.*functioning\sexternal\sload\sbalancer"
|
|
|
|
"Services.*identically\snamed"
|
|
|
|
"Services.*release.*load\sbalancer"
|
|
|
|
)
|
2015-01-12 21:46:10 +00:00
|
|
|
|
2015-06-09 22:45:15 +00:00
|
|
|
# Define environment variables based on the Jenkins project name.
|
|
|
|
case ${JOB_NAME} in
|
|
|
|
# Runs all non-flaky tests on GCE, sequentially.
|
|
|
|
kubernetes-e2e-gce)
|
|
|
|
: ${E2E_CLUSTER_NAME:="jenkins-gce-e2e"}
|
|
|
|
: ${E2E_DOWN:="false"}
|
|
|
|
: ${E2E_NETWORK:="e2e-gce"}
|
2015-07-23 11:30:01 +00:00
|
|
|
: ${GINKGO_TEST_ARGS:="--ginkgo.skip=$(join_regex_allow_empty \
|
2015-07-15 06:50:09 +00:00
|
|
|
${GCE_DEFAULT_SKIP_TESTS[@]:+${GCE_DEFAULT_SKIP_TESTS[@]}} \
|
|
|
|
${GCE_FLAKY_TESTS[@]:+${GCE_FLAKY_TESTS[@]}} \
|
|
|
|
)"}
|
2015-06-09 22:45:15 +00:00
|
|
|
: ${KUBE_GCE_INSTANCE_PREFIX="e2e-gce"}
|
|
|
|
: ${PROJECT:="k8s-jkns-e2e-gce"}
|
|
|
|
;;
|
|
|
|
|
2015-07-20 20:33:35 +00:00
|
|
|
# Runs only the examples tests on GCE.
|
|
|
|
kubernetes-e2e-gce-examples)
|
|
|
|
: ${E2E_CLUSTER_NAME:="jenkins-gce-e2e-examples"}
|
|
|
|
: ${E2E_DOWN:="false"}
|
|
|
|
: ${E2E_NETWORK:="e2e-examples"}
|
|
|
|
: ${GINKGO_TEST_ARGS:="--ginkgo.focus=Example"}
|
|
|
|
: ${KUBE_GCE_INSTANCE_PREFIX:="e2e-examples"}
|
|
|
|
: ${PROJECT:="kubernetes-jenkins"}
|
|
|
|
;;
|
|
|
|
|
2015-06-09 22:45:15 +00:00
|
|
|
# Runs the flaky tests on GCE, sequentially.
|
|
|
|
kubernetes-e2e-gce-flaky)
|
|
|
|
: ${E2E_CLUSTER_NAME:="jenkins-gce-e2e-flaky"}
|
|
|
|
: ${E2E_DOWN:="false"}
|
|
|
|
: ${E2E_NETWORK:="e2e-flaky"}
|
2015-07-23 11:30:01 +00:00
|
|
|
: ${GINKGO_TEST_ARGS:="--ginkgo.skip=$(join_regex_allow_empty \
|
2015-07-15 06:50:09 +00:00
|
|
|
${GCE_DEFAULT_SKIP_TESTS[@]:+${GCE_DEFAULT_SKIP_TESTS[@]}} \
|
2015-07-23 11:30:01 +00:00
|
|
|
) --ginkgo.focus=$(join_regex_no_empty \
|
2015-07-15 06:50:09 +00:00
|
|
|
${GCE_FLAKY_TESTS[@]:+${GCE_FLAKY_TESTS[@]}} \
|
|
|
|
)"}
|
2015-06-09 22:45:15 +00:00
|
|
|
: ${KUBE_GCE_INSTANCE_PREFIX:="e2e-flaky"}
|
|
|
|
: ${PROJECT:="k8s-jkns-e2e-gce-flaky"}
|
|
|
|
;;
|
|
|
|
|
|
|
|
# Runs all non-flaky tests on GCE in parallel.
|
|
|
|
kubernetes-e2e-gce-parallel)
|
|
|
|
: ${E2E_CLUSTER_NAME:="jenkins-gce-e2e-parallel"}
|
|
|
|
: ${E2E_NETWORK:="e2e-parallel"}
|
|
|
|
: ${GINKGO_PARALLEL:="y"}
|
2015-07-23 11:30:01 +00:00
|
|
|
: ${GINKGO_TEST_ARGS:="--ginkgo.skip=$(join_regex_allow_empty \
|
2015-07-15 06:50:09 +00:00
|
|
|
${GCE_DEFAULT_SKIP_TESTS[@]:+${GCE_DEFAULT_SKIP_TESTS[@]}} \
|
|
|
|
${GCE_PARALLEL_SKIP_TESTS[@]:+${GCE_PARALLEL_SKIP_TESTS[@]}} \
|
|
|
|
${GCE_PARALLEL_FLAKY_TESTS[@]:+${GCE_PARALLEL_FLAKY_TESTS[@]}} \
|
|
|
|
)"}
|
2015-06-09 22:45:15 +00:00
|
|
|
: ${KUBE_GCE_INSTANCE_PREFIX:="e2e-test-parallel"}
|
|
|
|
: ${PROJECT:="kubernetes-jenkins"}
|
|
|
|
# Override GCE defaults.
|
|
|
|
NUM_MINIONS="6"
|
|
|
|
;;
|
|
|
|
|
|
|
|
# Runs the flaky tests on GCE in parallel.
|
|
|
|
kubernetes-e2e-gce-parallel-flaky)
|
|
|
|
: ${E2E_CLUSTER_NAME:="parallel-flaky"}
|
|
|
|
: ${E2E_NETWORK:="e2e-parallel-flaky"}
|
|
|
|
: ${GINKGO_PARALLEL:="y"}
|
2015-07-23 11:30:01 +00:00
|
|
|
: ${GINKGO_TEST_ARGS:="--ginkgo.skip=$(join_regex_allow_empty \
|
2015-07-15 06:50:09 +00:00
|
|
|
${GCE_DEFAULT_SKIP_TESTS[@]:+${GCE_DEFAULT_SKIP_TESTS[@]}} \
|
|
|
|
${GCE_PARALLEL_SKIP_TESTS[@]:+${GCE_PARALLEL_SKIP_TESTS[@]}} \
|
2015-07-23 11:30:01 +00:00
|
|
|
) --ginkgo.focus=$(join_regex_no_empty \
|
2015-07-15 06:50:09 +00:00
|
|
|
${GCE_PARALLEL_FLAKY_TESTS[@]:+${GCE_PARALLEL_FLAKY_TESTS[@]}} \
|
|
|
|
)"}
|
2015-06-09 22:45:15 +00:00
|
|
|
: ${KUBE_GCE_INSTANCE_PREFIX:="parallel-flaky"}
|
|
|
|
: ${PROJECT:="k8s-jkns-e2e-gce-prl-flaky"}
|
|
|
|
# Override GCE defaults.
|
|
|
|
NUM_MINIONS="4"
|
|
|
|
;;
|
|
|
|
|
|
|
|
# Runs only the reboot tests on GCE.
|
|
|
|
kubernetes-e2e-gce-reboot)
|
|
|
|
: ${E2E_CLUSTER_NAME:="jenkins-gce-e2e-reboot"}
|
|
|
|
: ${E2E_DOWN:="false"}
|
|
|
|
: ${E2E_NETWORK:="e2e-reboot"}
|
|
|
|
: ${GINKGO_TEST_ARGS:=" --ginkgo.focus=Reboot"}
|
|
|
|
: ${KUBE_GCE_INSTANCE_PREFIX:="e2e-reboot"}
|
|
|
|
: ${PROJECT:="kubernetes-jenkins"}
|
|
|
|
;;
|
|
|
|
|
|
|
|
# Runs the performance/scalability tests on GCE. A larger cluster is used.
|
|
|
|
kubernetes-e2e-gce-scalability)
|
|
|
|
: ${E2E_CLUSTER_NAME:="jenkins-gce-e2e-scalability"}
|
|
|
|
: ${E2E_NETWORK:="e2e-scalability"}
|
2015-07-07 12:29:16 +00:00
|
|
|
: ${GINKGO_TEST_ARGS:="--ginkgo.focus=Performance\ssuite"}
|
2015-06-09 22:45:15 +00:00
|
|
|
: ${KUBE_GCE_INSTANCE_PREFIX:="e2e-scalability"}
|
|
|
|
: ${PROJECT:="kubernetes-jenkins"}
|
|
|
|
# Override GCE defaults.
|
|
|
|
MASTER_SIZE="n1-standard-4"
|
|
|
|
MINION_SIZE="n1-standard-2"
|
|
|
|
MINION_DISK_SIZE="50GB"
|
|
|
|
NUM_MINIONS="100"
|
|
|
|
;;
|
|
|
|
|
|
|
|
# Runs a subset of tests on GCE in parallel. Run against all pending PRs.
|
|
|
|
kubernetes-pull-build-test-e2e-gce)
|
|
|
|
: ${E2E_CLUSTER_NAME:="jenkins-pull-gce-e2e-${EXECUTOR_NUMBER}"}
|
|
|
|
: ${E2E_NETWORK:="pull-e2e-parallel-${EXECUTOR_NUMBER}"}
|
|
|
|
: ${GINKGO_PARALLEL:="y"}
|
|
|
|
# This list should match the list in kubernetes-e2e-gce-parallel. It
|
|
|
|
# currently also excludes a slow namespace test.
|
2015-07-23 11:30:01 +00:00
|
|
|
: ${GINKGO_TEST_ARGS:="--ginkgo.skip=$(join_regex_allow_empty \
|
2015-07-15 06:50:09 +00:00
|
|
|
${GCE_DEFAULT_SKIP_TESTS[@]:+${GCE_DEFAULT_SKIP_TESTS[@]}} \
|
|
|
|
${GCE_PARALLEL_SKIP_TESTS[@]:+${GCE_PARALLEL_SKIP_TESTS[@]}} \
|
|
|
|
${GCE_PARALLEL_FLAKY_TESTS[@]:+${GCE_PARALLEL_FLAKY_TESTS[@]}} \
|
|
|
|
)"}
|
2015-06-09 22:45:15 +00:00
|
|
|
: ${KUBE_GCE_INSTANCE_PREFIX:="pull-e2e-${EXECUTOR_NUMBER}"}
|
|
|
|
: ${KUBE_GCS_STAGING_PATH_SUFFIX:="-${EXECUTOR_NUMBER}"}
|
|
|
|
: ${PROJECT:="kubernetes-jenkins-pull"}
|
|
|
|
# Override GCE defaults.
|
|
|
|
MASTER_SIZE="n1-standard-1"
|
|
|
|
MINION_SIZE="n1-standard-1"
|
|
|
|
NUM_MINIONS="2"
|
|
|
|
;;
|
2015-07-08 16:45:16 +00:00
|
|
|
|
|
|
|
# Runs non-flaky tests on GCE on the release-latest branch,
|
|
|
|
# sequentially. As a reminder, if you need to change the skip list
|
|
|
|
# or flaky test list on the release branch, you'll need to propose a
|
|
|
|
# pull request directly to the release branch itself.
|
|
|
|
kubernetes-e2e-gce-release)
|
|
|
|
: ${E2E_CLUSTER_NAME:="jenkins-gce-e2e-release"}
|
|
|
|
: ${E2E_DOWN:="false"}
|
|
|
|
: ${E2E_NETWORK:="e2e-gce-release"}
|
2015-07-23 11:30:01 +00:00
|
|
|
: ${GINKGO_TEST_ARGS:="--ginkgo.skip=$(join_regex_allow_empty \
|
2015-07-15 06:50:09 +00:00
|
|
|
${GCE_DEFAULT_SKIP_TESTS[@]:+${GCE_DEFAULT_SKIP_TESTS[@]}} \
|
|
|
|
${GCE_FLAKY_TESTS[@]:+${GCE_FLAKY_TESTS[@]}} \
|
|
|
|
)"}
|
2015-07-08 16:45:16 +00:00
|
|
|
: ${KUBE_GCE_INSTANCE_PREFIX="e2e-gce"}
|
|
|
|
: ${PROJECT:="k8s-jkns-e2e-gce-release"}
|
|
|
|
;;
|
2015-06-09 22:45:15 +00:00
|
|
|
esac
|
2015-05-08 22:46:42 +00:00
|
|
|
|
2015-02-11 17:45:27 +00:00
|
|
|
# AWS variables
|
|
|
|
export KUBE_AWS_INSTANCE_PREFIX=${E2E_CLUSTER_NAME}
|
|
|
|
export KUBE_AWS_ZONE=${E2E_ZONE}
|
|
|
|
|
2015-01-12 21:46:10 +00:00
|
|
|
# GCE variables
|
|
|
|
export INSTANCE_PREFIX=${E2E_CLUSTER_NAME}
|
|
|
|
export KUBE_GCE_ZONE=${E2E_ZONE}
|
|
|
|
export KUBE_GCE_NETWORK=${E2E_NETWORK}
|
2015-06-09 22:45:15 +00:00
|
|
|
export KUBE_GCE_INSTANCE_PREFIX=${KUBE_GCE_INSTANCE_PREFIX:-}
|
|
|
|
export KUBE_GCS_STAGING_PATH_SUFFIX=${KUBE_GCS_STAGING_PATH_SUFFIX:-}
|
2015-01-12 21:46:10 +00:00
|
|
|
|
|
|
|
# GKE variables
|
|
|
|
export CLUSTER_NAME=${E2E_CLUSTER_NAME}
|
|
|
|
export ZONE=${E2E_ZONE}
|
|
|
|
export KUBE_GKE_NETWORK=${E2E_NETWORK}
|
|
|
|
|
2015-06-09 22:45:15 +00:00
|
|
|
# Shared cluster variables
|
2015-07-23 22:22:02 +00:00
|
|
|
export E2E_MIN_STARTUP_PODS=${E2E_MIN_STARTUP_PODS:-}
|
2015-06-09 22:45:15 +00:00
|
|
|
export MASTER_SIZE=${MASTER_SIZE:-}
|
|
|
|
export MINION_SIZE=${MINION_SIZE:-}
|
|
|
|
export NUM_MINIONS=${NUM_MINIONS:-}
|
|
|
|
export PROJECT=${PROJECT:-}
|
|
|
|
|
2015-01-12 21:46:10 +00:00
|
|
|
export PATH=${PATH}:/usr/local/go/bin
|
|
|
|
export KUBE_SKIP_CONFIRMATIONS=y
|
|
|
|
|
2015-05-07 23:48:54 +00:00
|
|
|
# E2E Control Variables
|
|
|
|
export E2E_UP="${E2E_UP:-true}"
|
|
|
|
export E2E_TEST="${E2E_TEST:-true}"
|
|
|
|
export E2E_DOWN="${E2E_DOWN:-true}"
|
2015-06-09 22:45:15 +00:00
|
|
|
# Used by hack/ginkgo-e2e.sh to enable ginkgo's parallel test runner.
|
|
|
|
export GINKGO_PARALLEL=${GINKGO_PARALLEL:-}
|
|
|
|
|
|
|
|
echo "--------------------------------------------------------------------------------"
|
|
|
|
echo "Test Environment:"
|
|
|
|
printenv | sort
|
|
|
|
echo "--------------------------------------------------------------------------------"
|
2015-05-07 23:48:54 +00:00
|
|
|
|
2015-07-07 21:00:18 +00:00
|
|
|
# We get the Kubernetes tarballs on either cluster creation or when we want to
|
|
|
|
# replace existing ones in a multi-step job (e.g. a cluster upgrade).
|
|
|
|
if [[ "${E2E_UP,,}" == "true" || "${JENKINS_FORCE_GET_TARS:-}" =~ ^[yY]$ ]]; then
|
2015-05-08 21:36:44 +00:00
|
|
|
if [[ ${KUBE_RUN_FROM_OUTPUT:-} =~ ^[yY]$ ]]; then
|
|
|
|
echo "Found KUBE_RUN_FROM_OUTPUT=y; will use binaries from _output"
|
|
|
|
cp _output/release-tars/kubernetes*.tar.gz .
|
|
|
|
else
|
|
|
|
echo "Pulling binaries from GCS"
|
2015-07-07 21:00:18 +00:00
|
|
|
# In a multi-step job, clean up just the kubernetes build files.
|
|
|
|
# Otherwise, we want a completely empty directory.
|
|
|
|
if [[ "${JENKINS_FORCE_GET_TARS:-}" =~ ^[yY]$ ]]; then
|
|
|
|
rm -rf kubernetes*
|
|
|
|
elif [[ $(find . | wc -l) != 1 ]]; then
|
2015-05-08 21:36:44 +00:00
|
|
|
echo $PWD not empty, bailing!
|
|
|
|
exit 1
|
|
|
|
fi
|
2015-05-12 00:31:29 +00:00
|
|
|
|
2015-05-08 21:36:44 +00:00
|
|
|
# Tell kube-up.sh to skip the update, it doesn't lock. An internal
|
|
|
|
# gcloud bug can cause racing component updates to stomp on each
|
|
|
|
# other.
|
|
|
|
export KUBE_SKIP_UPDATE=y
|
|
|
|
sudo flock -x -n /var/run/lock/gcloud-components.lock -c "gcloud components update -q" || true
|
2015-07-07 20:22:54 +00:00
|
|
|
sudo flock -x -n /var/run/lock/gcloud-components.lock -c "gcloud components update preview -q" || true
|
|
|
|
sudo flock -x -n /var/run/lock/gcloud-components.lock -c "gcloud components update alpha -q" || true
|
|
|
|
sudo flock -x -n /var/run/lock/gcloud-components.lock -c "gcloud components update beta -q" || true
|
2015-05-08 21:36:44 +00:00
|
|
|
|
2015-06-19 23:18:27 +00:00
|
|
|
if [[ ! -z ${JENKINS_EXPLICIT_VERSION:-} ]]; then
|
|
|
|
# Use an explicit pinned version like "ci/v0.10.0-101-g6c814c4" or
|
|
|
|
# "release/v0.19.1"
|
|
|
|
IFS='/' read -a varr <<< "${JENKINS_EXPLICIT_VERSION}"
|
|
|
|
bucket="${varr[0]}"
|
|
|
|
githash="${varr[1]}"
|
|
|
|
echo "$bucket / $githash"
|
2015-05-12 00:31:29 +00:00
|
|
|
else
|
|
|
|
# The "ci" bucket is for builds like "v0.15.0-468-gfa648c1"
|
|
|
|
bucket="ci"
|
|
|
|
# The "latest" version picks the most recent "ci" or "release" build.
|
|
|
|
version_file="latest"
|
|
|
|
if [[ ${JENKINS_USE_RELEASE_TARS:-} =~ ^[yY]$ ]]; then
|
|
|
|
# The "release" bucket is for builds like "v0.15.0"
|
|
|
|
bucket="release"
|
|
|
|
if [[ ${JENKINS_USE_STABLE:-} =~ ^[yY]$ ]]; then
|
|
|
|
# The "stable" version picks the most recent "release" build.
|
|
|
|
version_file="stable"
|
|
|
|
fi
|
2015-05-08 21:36:44 +00:00
|
|
|
fi
|
2015-05-12 00:31:29 +00:00
|
|
|
githash=$(gsutil cat gs://kubernetes-release/${bucket}/${version_file}.txt)
|
2015-05-08 21:36:44 +00:00
|
|
|
fi
|
2015-05-12 00:31:29 +00:00
|
|
|
# At this point, we want to have the following vars set:
|
|
|
|
# - bucket
|
|
|
|
# - githash
|
2015-05-08 21:36:44 +00:00
|
|
|
gsutil -m cp gs://kubernetes-release/${bucket}/${githash}/kubernetes.tar.gz gs://kubernetes-release/${bucket}/${githash}/kubernetes-test.tar.gz .
|
2015-02-11 17:45:27 +00:00
|
|
|
fi
|
|
|
|
|
2015-05-08 21:36:44 +00:00
|
|
|
if [[ ! "${CIRCLECI:-}" == "true" ]]; then
|
|
|
|
# Copy GCE keys so we don't keep cycling them.
|
2015-07-14 22:12:05 +00:00
|
|
|
# To set this up, you must know the <project>, <zone>, and <instance>
|
2015-05-08 21:36:44 +00:00
|
|
|
# on which your jenkins jobs are running. Then do:
|
|
|
|
#
|
2015-07-14 22:12:05 +00:00
|
|
|
# # SSH from your computer into the instance.
|
2015-05-08 21:36:44 +00:00
|
|
|
# $ gcloud compute ssh --project="<prj>" ssh --zone="<zone>" <instance>
|
|
|
|
#
|
2015-07-14 22:12:05 +00:00
|
|
|
# # Generate a key by ssh'ing from the instance into itself, then exit.
|
2015-05-08 21:36:44 +00:00
|
|
|
# $ gcloud compute ssh --project="<prj>" ssh --zone="<zone>" <instance>
|
|
|
|
# $ ^D
|
|
|
|
#
|
2015-07-14 22:12:05 +00:00
|
|
|
# # Copy the keys to the desired location (e.g. /var/lib/jenkins/gce_keys/).
|
2015-05-08 21:36:44 +00:00
|
|
|
# $ sudo mkdir -p /var/lib/jenkins/gce_keys/
|
|
|
|
# $ sudo cp ~/.ssh/google_compute_engine /var/lib/jenkins/gce_keys/
|
|
|
|
# $ sudo cp ~/.ssh/google_compute_engine.pub /var/lib/jenkins/gce_keys/
|
|
|
|
#
|
2015-07-14 22:12:05 +00:00
|
|
|
# # Move the permissions for the keys to Jenkins.
|
2015-05-08 21:36:44 +00:00
|
|
|
# $ sudo chown -R jenkins /var/lib/jenkins/gce_keys/
|
|
|
|
# $ sudo chgrp -R jenkins /var/lib/jenkins/gce_keys/
|
|
|
|
if [[ "${KUBERNETES_PROVIDER}" == "aws" ]]; then
|
|
|
|
echo "Skipping SSH key copying for AWS"
|
|
|
|
else
|
|
|
|
mkdir -p ${WORKSPACE}/.ssh/
|
|
|
|
cp /var/lib/jenkins/gce_keys/google_compute_engine ${WORKSPACE}/.ssh/
|
|
|
|
cp /var/lib/jenkins/gce_keys/google_compute_engine.pub ${WORKSPACE}/.ssh/
|
2015-04-21 22:22:36 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2015-05-08 21:36:44 +00:00
|
|
|
md5sum kubernetes*.tar.gz
|
|
|
|
tar -xzf kubernetes.tar.gz
|
|
|
|
tar -xzf kubernetes-test.tar.gz
|
2015-01-12 21:46:10 +00:00
|
|
|
|
2015-05-08 21:36:44 +00:00
|
|
|
# Set by GKE-CI to change the CLUSTER_API_VERSION to the git version
|
|
|
|
if [[ ! -z ${E2E_SET_CLUSTER_API_VERSION:-} ]]; then
|
|
|
|
export CLUSTER_API_VERSION=$(echo ${githash} | cut -c 2-)
|
|
|
|
elif [[ ${JENKINS_USE_RELEASE_TARS:-} =~ ^[yY]$ ]]; then
|
|
|
|
release=$(gsutil cat gs://kubernetes-release/release/${version_file}.txt | cut -c 2-)
|
|
|
|
export CLUSTER_API_VERSION=${release}
|
|
|
|
fi
|
2015-05-08 22:52:56 +00:00
|
|
|
fi
|
|
|
|
|
2015-01-12 21:46:10 +00:00
|
|
|
cd kubernetes
|
|
|
|
|
2015-02-05 18:23:19 +00:00
|
|
|
# Have cmd/e2e run by goe2e.sh generate JUnit report in ${WORKSPACE}/junit*.xml
|
2015-05-29 20:25:17 +00:00
|
|
|
ARTIFACTS=${WORKSPACE}/_artifacts
|
|
|
|
mkdir -p ${ARTIFACTS}
|
|
|
|
export E2E_REPORT_DIR=${ARTIFACTS}
|
2015-02-05 18:23:19 +00:00
|
|
|
|
2015-02-18 00:37:27 +00:00
|
|
|
### Set up ###
|
2015-05-07 23:48:54 +00:00
|
|
|
if [[ "${E2E_UP,,}" == "true" ]]; then
|
2015-05-08 21:36:44 +00:00
|
|
|
go run ./hack/e2e.go ${E2E_OPT} -v --down
|
|
|
|
go run ./hack/e2e.go ${E2E_OPT} -v --up
|
|
|
|
go run ./hack/e2e.go -v --ctl="version --match-server-version=false"
|
2015-05-07 23:48:54 +00:00
|
|
|
fi
|
2015-02-18 00:37:27 +00:00
|
|
|
|
|
|
|
### Run tests ###
|
|
|
|
# Jenkins will look at the junit*.xml files for test failures, so don't exit
|
|
|
|
# with a nonzero error code if it was only tests that failed.
|
2015-05-07 23:48:54 +00:00
|
|
|
if [[ "${E2E_TEST,,}" == "true" ]]; then
|
2015-06-27 01:12:42 +00:00
|
|
|
go run ./hack/e2e.go ${E2E_OPT} -v --test --test_args="${GINKGO_TEST_ARGS}" && exitcode=0 || exitcode=$?
|
|
|
|
if [[ "${E2E_PUBLISH_GREEN_VERSION:-}" == "true" && ${exitcode} == 0 && -n ${githash:-} ]]; then
|
|
|
|
echo "publish githash to ci/latest-green.txt: ${githash}"
|
|
|
|
echo "${githash}" > ${WORKSPACE}/githash.txt
|
|
|
|
gsutil cp ${WORKSPACE}/githash.txt gs://kubernetes-release/ci/latest-green.txt
|
|
|
|
fi
|
2015-05-07 23:48:54 +00:00
|
|
|
fi
|
2015-02-18 00:37:27 +00:00
|
|
|
|
2015-05-29 20:25:17 +00:00
|
|
|
# TODO(zml): We have a bunch of legacy Jenkins configs that are
|
|
|
|
# expecting junit*.xml to be in ${WORKSPACE} root and it's Friday
|
|
|
|
# afternoon, so just put the junit report where it's expected.
|
2015-06-15 01:45:39 +00:00
|
|
|
# If link already exists, non-zero return code should not cause build to fail.
|
2015-05-29 20:25:17 +00:00
|
|
|
for junit in ${ARTIFACTS}/junit*.xml; do
|
2015-06-15 01:45:39 +00:00
|
|
|
ln -s -f ${junit} ${WORKSPACE} || true
|
2015-05-29 20:25:17 +00:00
|
|
|
done
|
|
|
|
|
2015-02-18 00:37:27 +00:00
|
|
|
### Clean up ###
|
2015-05-07 23:48:54 +00:00
|
|
|
if [[ "${E2E_DOWN,,}" == "true" ]]; then
|
2015-05-26 17:51:36 +00:00
|
|
|
# Sleep before deleting the cluster to give the controller manager time to
|
|
|
|
# delete any cloudprovider resources still around from the last test.
|
2015-05-26 21:09:05 +00:00
|
|
|
# This is calibrated to allow enough time for 3 attempts to delete the
|
|
|
|
# resources. Each attempt is allocated 5 seconds for requests to the
|
|
|
|
# cloudprovider plus the processingRetryInterval from servicecontroller.go
|
|
|
|
# for the wait between attempts.
|
|
|
|
sleep 30
|
2015-05-08 21:36:44 +00:00
|
|
|
go run ./hack/e2e.go ${E2E_OPT} -v --down
|
2015-05-07 23:48:54 +00:00
|
|
|
fi
|