Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7ddd29d

Browse files
committed
Merge pull request kubernetes#19208 from spxtr/split-e2e-1.0
Call master-branch e2e-runner.sh from release-1.0 e2e.sh.
2 parents 5ce63d3 + 94c91ef commit 7ddd29d

File tree

1 file changed

+7
-197
lines changed

1 file changed

+7
-197
lines changed

hack/jenkins/e2e.sh

Lines changed: 7 additions & 197 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,7 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
# kubernetes-e2e-{gce, gke, gke-ci} jobs: This script is triggered by
18-
# the kubernetes-build job, or runs every half hour. We abort this job
19-
# if it takes more than 75m. As of initial commit, it typically runs
20-
# in about half an hour.
21-
#
22-
# The "Workspace Cleanup Plugin" is installed and in use for this job,
23-
# so the ${WORKSPACE} directory (the current directory) is currently
24-
# empty.
17+
# Sets up environment variables for e2e-runner.sh on the master branch.
2518

2619
set -o errexit
2720
set -o nounset
@@ -474,6 +467,7 @@ export KUBE_GCS_STAGING_PATH_SUFFIX=${KUBE_GCS_STAGING_PATH_SUFFIX:-}
474467
export KUBE_GCE_MINION_PROJECT=${KUBE_GCE_MINION_PROJECT:-}
475468
export KUBE_GCE_MINION_IMAGE=${KUBE_GCE_MINION_IMAGE:-}
476469
export KUBE_OS_DISTRIBUTION=${KUBE_OS_DISTRIBUTION:-}
470+
export GCE_SERVICE_ACCOUNT=$(gcloud auth list 2> /dev/null | grep active | cut -f3 -d' ')
477471

478472
# GKE variables
479473
export CLUSTER_NAME=${E2E_CLUSTER_NAME}
@@ -503,7 +497,7 @@ export TEST_CLUSTER_LOG_LEVEL=${TEST_CLUSTER_LOG_LEVEL:-}
503497
export TEST_CLUSTER_RESYNC_PERIOD=${TEST_CLUSTER_RESYNC_PERIOD:-}
504498
export PROJECT=${PROJECT:-}
505499
export JENKINS_EXPLICIT_VERSION=${JENKINS_EXPLICIT_VERSION:-}
506-
export JENKINS_PUBLISHED_VERSION=${JENKINS_PUBLISHED_VERSION:-'ci/latest'}
500+
export JENKINS_PUBLISHED_VERSION=${JENKINS_PUBLISHED_VERSION:-'ci/latest-1.0'}
507501

508502
export KUBE_ADMISSION_CONTROL=${ADMISSION_CONTROL:-}
509503

@@ -513,198 +507,14 @@ export KUBE_SKIP_UPDATE=y
513507
export KUBE_SKIP_CONFIRMATIONS=y
514508

515509
# E2E Control Variables
510+
export E2E_OPT="${E2E_OPT:-}"
516511
export E2E_UP="${E2E_UP:-true}"
517512
export E2E_TEST="${E2E_TEST:-true}"
518513
export E2E_DOWN="${E2E_DOWN:-true}"
519514
export E2E_CLEAN_START="${E2E_CLEAN_START:-}"
520515
# Used by hack/ginkgo-e2e.sh to enable ginkgo's parallel test runner.
521516
export GINKGO_PARALLEL=${GINKGO_PARALLEL:-}
517+
export GINKGO_TEST_ARGS="${GINKGO_TEST_ARGS:-}"
522518

523-
echo "--------------------------------------------------------------------------------"
524-
echo "Test Environment:"
525-
printenv | sort
526-
echo "--------------------------------------------------------------------------------"
527-
528-
# We get the Kubernetes tarballs on either cluster creation or when we want to
529-
# replace existing ones in a multi-step job (e.g. a cluster upgrade).
530-
if [[ "${E2E_UP,,}" == "true" || "${JENKINS_FORCE_GET_TARS:-}" =~ ^[yY]$ ]]; then
531-
if [[ ${KUBE_RUN_FROM_OUTPUT:-} =~ ^[yY]$ ]]; then
532-
echo "Found KUBE_RUN_FROM_OUTPUT=y; will use binaries from _output"
533-
cp _output/release-tars/kubernetes*.tar.gz .
534-
else
535-
echo "Pulling binaries from GCS"
536-
# In a multi-step job, clean up just the kubernetes build files.
537-
# Otherwise, we want a completely empty directory.
538-
if [[ "${JENKINS_FORCE_GET_TARS:-}" =~ ^[yY]$ ]]; then
539-
rm -rf kubernetes*
540-
elif [[ $(find . | wc -l) != 1 ]]; then
541-
echo $PWD not empty, bailing!
542-
exit 1
543-
fi
544-
545-
if [[ ! -z ${JENKINS_EXPLICIT_VERSION:-} ]]; then
546-
# Use an explicit pinned version like "ci/v0.10.0-101-g6c814c4" or
547-
# "release/v0.19.1"
548-
IFS='/' read -a varr <<< "${JENKINS_EXPLICIT_VERSION}"
549-
bucket="${varr[0]}"
550-
githash="${varr[1]}"
551-
echo "Using explicit version $bucket/$githash"
552-
elif [[ ${JENKINS_USE_SERVER_VERSION:-} =~ ^[yY]$ ]]; then
553-
# for GKE we can use server default version.
554-
bucket="release"
555-
msg=$(gcloud ${CMD_GROUP} container get-server-config --project=${PROJECT} --zone=${ZONE} | grep defaultClusterVersion)
556-
# msg will look like "defaultClusterVersion: 1.0.1". Strip
557-
# everything up to, including ": "
558-
githash="v${msg##*: }"
559-
echo "Using server version $bucket/$githash"
560-
else # use JENKINS_PUBLISHED_VERSION
561-
# Use a published version like "ci/latest" (default),
562-
# "release/latest", "release/latest-1", or "release/stable"
563-
IFS='/' read -a varr <<< "${JENKINS_PUBLISHED_VERSION}"
564-
bucket="${varr[0]}"
565-
githash=$(gsutil cat gs://kubernetes-release/${JENKINS_PUBLISHED_VERSION}.txt)
566-
echo "Using published version $bucket/$githash (from ${JENKINS_PUBLISHED_VERSION})"
567-
fi
568-
# At this point, we want to have the following vars set:
569-
# - bucket
570-
# - githash
571-
gsutil -m cp gs://kubernetes-release/${bucket}/${githash}/kubernetes.tar.gz gs://kubernetes-release/${bucket}/${githash}/kubernetes-test.tar.gz .
572-
573-
# Set by GKE-CI to change the CLUSTER_API_VERSION to the git version
574-
if [[ ! -z ${E2E_SET_CLUSTER_API_VERSION:-} ]]; then
575-
export CLUSTER_API_VERSION=$(echo ${githash} | cut -c 2-)
576-
fi
577-
fi
578-
579-
if [[ ! "${CIRCLECI:-}" == "true" ]]; then
580-
# Copy GCE keys so we don't keep cycling them.
581-
# To set this up, you must know the <project>, <zone>, and <instance>
582-
# on which your jenkins jobs are running. Then do:
583-
#
584-
# # SSH from your computer into the instance.
585-
# $ gcloud compute ssh --project="<prj>" ssh --zone="<zone>" <instance>
586-
#
587-
# # Generate a key by ssh'ing from the instance into itself, then exit.
588-
# $ gcloud compute ssh --project="<prj>" ssh --zone="<zone>" <instance>
589-
# $ ^D
590-
#
591-
# # Copy the keys to the desired location (e.g. /var/lib/jenkins/gce_keys/).
592-
# $ sudo mkdir -p /var/lib/jenkins/gce_keys/
593-
# $ sudo cp ~/.ssh/google_compute_engine /var/lib/jenkins/gce_keys/
594-
# $ sudo cp ~/.ssh/google_compute_engine.pub /var/lib/jenkins/gce_keys/
595-
#
596-
# # Move the permissions for the keys to Jenkins.
597-
# $ sudo chown -R jenkins /var/lib/jenkins/gce_keys/
598-
# $ sudo chgrp -R jenkins /var/lib/jenkins/gce_keys/
599-
if [[ "${KUBERNETES_PROVIDER}" == "aws" ]]; then
600-
echo "Skipping SSH key copying for AWS"
601-
else
602-
mkdir -p ${WORKSPACE}/.ssh/
603-
cp /var/lib/jenkins/gce_keys/google_compute_engine ${WORKSPACE}/.ssh/
604-
cp /var/lib/jenkins/gce_keys/google_compute_engine.pub ${WORKSPACE}/.ssh/
605-
fi
606-
fi
607-
608-
md5sum kubernetes*.tar.gz
609-
tar -xzf kubernetes.tar.gz
610-
tar -xzf kubernetes-test.tar.gz
611-
fi
612-
613-
cd kubernetes
614-
615-
# Have cmd/e2e run by goe2e.sh generate JUnit report in ${WORKSPACE}/junit*.xml
616-
ARTIFACTS=${WORKSPACE}/_artifacts
617-
mkdir -p ${ARTIFACTS}
618-
export E2E_REPORT_DIR=${ARTIFACTS}
619-
declare -r gcp_list_resources_script="./cluster/gce/list-resources.sh"
620-
declare -r gcp_resources_before="${ARTIFACTS}/gcp-resources-before.txt"
621-
declare -r gcp_resources_cluster_up="${ARTIFACTS}/gcp-resources-cluster-up.txt"
622-
declare -r gcp_resources_after="${ARTIFACTS}/gcp-resources-after.txt"
623-
# TODO(15492): figure out some way to run this script even if it doesn't exist
624-
# in the Kubernetes tarball.
625-
if [[ ( ${KUBERNETES_PROVIDER} == "gce" || ${KUBERNETES_PROVIDER} == "gke" ) && -x "${gcp_list_resources_script}" ]]; then
626-
gcp_list_resources="true"
627-
else
628-
gcp_list_resources="false"
629-
fi
630-
631-
### Pre Set Up ###
632-
# Install gcloud from a custom path if provided. Used to test GKE with gcloud
633-
# at HEAD, release candidate.
634-
if [[ ! -z "${CLOUDSDK_BUCKET:-}" ]]; then
635-
gsutil -m cp -r "${CLOUDSDK_BUCKET}" ~
636-
rm -rf ~/repo ~/cloudsdk
637-
mv ~/$(basename "${CLOUDSDK_BUCKET}") ~/repo
638-
mkdir ~/cloudsdk
639-
tar zvxf ~/repo/google-cloud-sdk.tar.gz -C ~/cloudsdk
640-
export CLOUDSDK_CORE_DISABLE_PROMPTS=1
641-
export CLOUDSDK_COMPONENT_MANAGER_SNAPSHOT_URL=file://${HOME}/repo/components-2.json
642-
~/cloudsdk/google-cloud-sdk/install.sh --disable-installation-options --bash-completion=false --path-update=false --usage-reporting=false
643-
export PATH=${HOME}/cloudsdk/google-cloud-sdk/bin:${PATH}
644-
export CLOUDSDK_CONFIG=/var/lib/jenkins/.config/gcloud
645-
fi
646-
647-
### Set up ###
648-
if [[ "${E2E_UP,,}" == "true" ]]; then
649-
go run ./hack/e2e.go ${E2E_OPT} -v --down
650-
if [[ "${gcp_list_resources}" == "true" ]]; then
651-
${gcp_list_resources_script} > "${gcp_resources_before}"
652-
fi
653-
go run ./hack/e2e.go ${E2E_OPT} -v --up
654-
go run ./hack/e2e.go -v --ctl="version --match-server-version=false"
655-
if [[ "${gcp_list_resources}" == "true" ]]; then
656-
${gcp_list_resources_script} > "${gcp_resources_cluster_up}"
657-
fi
658-
fi
659-
660-
### Run tests ###
661-
# Jenkins will look at the junit*.xml files for test failures, so don't exit
662-
# with a nonzero error code if it was only tests that failed.
663-
if [[ "${E2E_TEST,,}" == "true" ]]; then
664-
go run ./hack/e2e.go ${E2E_OPT} -v --test --test_args="${GINKGO_TEST_ARGS}" && exitcode=0 || exitcode=$?
665-
if [[ "${E2E_PUBLISH_GREEN_VERSION:-}" == "true" && ${exitcode} == 0 && -n ${githash:-} ]]; then
666-
echo "publish githash to ci/latest-green.txt: ${githash}"
667-
echo "${githash}" > ${WORKSPACE}/githash.txt
668-
gsutil cp ${WORKSPACE}/githash.txt gs://kubernetes-release/ci/latest-green.txt
669-
fi
670-
fi
671-
672-
### Start Kubemark ###
673-
if [[ "${USE_KUBEMARK:-}" == "true" ]]; then
674-
export RUN_FROM_DISTRO=true
675-
NUM_MINIONS_BKP=${NUM_MINIONS}
676-
MASTER_SIZE_BKP=${MASTER_SIZE}
677-
./test/kubemark/stop-kubemark.sh
678-
NUM_MINIONS=${KUBEMARK_NUM_MINIONS:-$NUM_MINIONS}
679-
MASTER_SIZE=${KUBEMARK_MASTER_SIZE:-$MASTER_SIZE}
680-
./test/kubemark/start-kubemark.sh
681-
./test/kubemark/run-e2e-tests.sh --ginkgo.focus="should\sallow\sstarting\s30\spods\sper\snode" --delete-namespace="false" --gather-resource-usage="false"
682-
./test/kubemark/stop-kubemark.sh
683-
NUM_MINIONS=${NUM_MINIONS_BKP}
684-
MASTER_SIZE=${MASTER_SIZE_BKP}
685-
unset RUN_FROM_DISTRO
686-
unset NUM_MINIONS_BKP
687-
unset MASTER_SIZE_BKP
688-
fi
689-
690-
### Clean up ###
691-
if [[ "${E2E_DOWN,,}" == "true" ]]; then
692-
# Sleep before deleting the cluster to give the controller manager time to
693-
# delete any cloudprovider resources still around from the last test.
694-
# This is calibrated to allow enough time for 3 attempts to delete the
695-
# resources. Each attempt is allocated 5 seconds for requests to the
696-
# cloudprovider plus the processingRetryInterval from servicecontroller.go
697-
# for the wait between attempts.
698-
sleep 30
699-
go run ./hack/e2e.go ${E2E_OPT} -v --down
700-
if [[ "${gcp_list_resources}" == "true" ]]; then
701-
${gcp_list_resources_script} > "${gcp_resources_after}"
702-
fi
703-
fi
704-
705-
if [[ -f "${gcp_resources_before}" && -f "${gcp_resources_after}" ]]; then
706-
if ! diff -sw -U0 -F'^\[.*\]$' "${gcp_resources_before}" "${gcp_resources_after}" && [[ "${FAIL_ON_GCP_RESOURCE_LEAK:-}" == "true" ]]; then
707-
echo "!!! FAIL: Google Cloud Platform resources leaked while running tests!"
708-
exit 1
709-
fi
710-
fi
519+
# Use e2e-runner.sh from the master branch.
520+
source <(curl -fsS --retry 3 "https://raw.githubusercontent.com/kubernetes/kubernetes/master/hack/jenkins/e2e-runner.sh")

0 commit comments

Comments
 (0)