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

Skip to content

Commit 2369cc5

Browse files
author
k8s-merge-robot
committed
Merge pull request kubernetes#18028 from ihmccreery/auto-config-upgrades-1.0
Auto commit by PR queue bot
2 parents a13c86b + 8806428 commit 2369cc5

File tree

1 file changed

+192
-0
lines changed

1 file changed

+192
-0
lines changed

hack/jenkins/e2e.sh

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,161 @@ function join_regex_no_empty() {
4747
fi
4848
}
4949

50+
# Properly configure globals for an upgrade step in a GKE or GCE upgrade suite
51+
#
52+
# These suites:
53+
# step1: launch a cluster at $old_version,
54+
# step2: upgrades the master to $new_version,
55+
# step3: runs $old_version e2es,
56+
# step4: upgrades the rest of the cluster,
57+
# step5: runs $old_version e2es again, then
58+
# step6: runs $new_version e2es and tears down the cluster.
59+
#
60+
# Assumes globals:
61+
# $JOB_NAME
62+
# $KUBERNETES_PROVIDER
63+
# $GKE_DEFAULT_SKIP_TESTS
64+
# $GCE_DEFAULT_SKIP_TESTS
65+
# $GCE_FLAKY_TESTS
66+
# $GCE_SLOW_TESTS
67+
#
68+
# Args:
69+
# $1 old_version: the version to deploy a cluster at, and old e2e tests to run
70+
# against the upgraded cluster (should be something like
71+
# 'release/latest', to work with JENKINS_PUBLISHED_VERSION logic)
72+
# $2 new_version: the version to upgrade the cluster to, and new e2e tests to run
73+
# against the upgraded cluster (should be something like
74+
# 'ci/latest', to work with JENKINS_PUBLISHED_VERSION logic)
75+
# $3 cluster_name: determines E2E_CLUSTER_NAME and E2E_NETWORK
76+
# $4 project: determines PROJECT
77+
78+
function configure_upgrade_step() {
79+
local -r old_version="$1"
80+
local -r new_version="$2"
81+
local -r cluster_name="$3"
82+
local -r project="$4"
83+
84+
[[ "${JOB_NAME}" =~ .*-(step[1-6])-.* ]] || {
85+
echo "JOB_NAME ${JOB_NAME} is not a valid upgrade job name, could not parse"
86+
exit 1
87+
}
88+
local -r step="${BASH_REMATCH[1]}"
89+
90+
local -r gce_test_args="--ginkgo.skip=$(join_regex_allow_empty \
91+
${GCE_DEFAULT_SKIP_TESTS[@]:+${GCE_DEFAULT_SKIP_TESTS[@]}} \
92+
${GCE_FLAKY_TESTS[@]:+${GCE_FLAKY_TESTS[@]}} \
93+
${GCE_SLOW_TESTS[@]:+${GCE_SLOW_TESTS[@]}} \
94+
)"
95+
local -r gke_test_args="--ginkgo.skip=$(join_regex_allow_empty \
96+
${GKE_DEFAULT_SKIP_TESTS[@]:+${GKE_DEFAULT_SKIP_TESTS[@]}} \
97+
${GCE_DEFAULT_SKIP_TESTS[@]:+${GCE_DEFAULT_SKIP_TESTS[@]}} \
98+
${GCE_FLAKY_TESTS[@]:+${GCE_FLAKY_TESTS[@]}} \
99+
${GCE_SLOW_TESTS[@]:+${GCE_SLOW_TESTS[@]}} \
100+
)"
101+
102+
if [[ "${KUBERNETES_PROVIDER}" == "gke" ]]; then
103+
DOGFOOD_GCLOUD="true"
104+
GKE_API_ENDPOINT="https://test-container.sandbox.googleapis.com/"
105+
fi
106+
107+
E2E_CLUSTER_NAME="$cluster_name"
108+
E2E_NETWORK="$cluster_name"
109+
PROJECT="$project"
110+
111+
case $step in
112+
step1)
113+
# Deploy at old version
114+
JENKINS_PUBLISHED_VERSION="${old_version}"
115+
116+
E2E_UP="true"
117+
E2E_TEST="false"
118+
E2E_DOWN="false"
119+
120+
if [[ "${KUBERNETES_PROVIDER}" == "gke" ]]; then
121+
E2E_SET_CLUSTER_API_VERSION=y
122+
fi
123+
;;
124+
125+
step2)
126+
# Use upgrade logic of version we're upgrading to.
127+
JENKINS_PUBLISHED_VERSION="${new_version}"
128+
JENKINS_FORCE_GET_TARS=y
129+
130+
E2E_OPT="--check_version_skew=false"
131+
E2E_UP="false"
132+
E2E_TEST="true"
133+
E2E_DOWN="false"
134+
GINKGO_TEST_ARGS="--ginkgo.focus=Cluster\sUpgrade.*upgrade-master --upgrade-target=${new_version}"
135+
;;
136+
137+
step3)
138+
# Run old e2es
139+
JENKINS_PUBLISHED_VERSION="${old_version}"
140+
JENKINS_FORCE_GET_TARS=y
141+
142+
E2E_OPT="--check_version_skew=false"
143+
E2E_UP="false"
144+
E2E_TEST="true"
145+
E2E_DOWN="false"
146+
147+
if [[ "${KUBERNETES_PROVIDER}" == "gke" ]]; then
148+
GINKGO_TEST_ARGS="${gke_test_args}"
149+
else
150+
GINKGO_TEST_ARGS="${gce_test_args}"
151+
fi
152+
;;
153+
154+
step4)
155+
# Use upgrade logic of version we're upgrading to.
156+
JENKINS_PUBLISHED_VERSION="${new_version}"
157+
JENKINS_FORCE_GET_TARS=y
158+
159+
E2E_OPT="--check_version_skew=false"
160+
E2E_UP="false"
161+
E2E_TEST="true"
162+
E2E_DOWN="false"
163+
GINKGO_TEST_ARGS="--ginkgo.focus=Cluster\sUpgrade.*upgrade-cluster --upgrade-target=${new_version}"
164+
;;
165+
166+
step5)
167+
# Run old e2es
168+
JENKINS_PUBLISHED_VERSION="${old_version}"
169+
JENKINS_FORCE_GET_TARS=y
170+
171+
E2E_OPT="--check_version_skew=false"
172+
E2E_UP="false"
173+
E2E_TEST="true"
174+
E2E_DOWN="false"
175+
176+
if [[ "${KUBERNETES_PROVIDER}" == "gke" ]]; then
177+
GINKGO_TEST_ARGS="${gke_test_args}"
178+
else
179+
GINKGO_TEST_ARGS="${gce_test_args}"
180+
fi
181+
;;
182+
183+
step6)
184+
# Run new e2es
185+
JENKINS_PUBLISHED_VERSION="${new_version}"
186+
JENKINS_FORCE_GET_TARS=y
187+
188+
# TODO(15011): these really shouldn't be (very) version skewed, but
189+
# because we have to get ci/latest again, it could get slightly out of
190+
# whack.
191+
E2E_OPT="--check_version_skew=false"
192+
E2E_UP="false"
193+
E2E_TEST="true"
194+
E2E_DOWN="true"
195+
196+
if [[ "${KUBERNETES_PROVIDER}" == "gke" ]]; then
197+
GINKGO_TEST_ARGS="${gke_test_args}"
198+
else
199+
GINKGO_TEST_ARGS="${gce_test_args}"
200+
fi
201+
;;
202+
esac
203+
}
204+
50205
echo "--------------------------------------------------------------------------------"
51206
echo "Initial Environment:"
52207
printenv | sort
@@ -254,6 +409,43 @@ case ${JOB_NAME} in
254409
: ${PROJECT:="k8s-jkns-e2e-gce-release"}
255410
;;
256411

412+
# kubernetes-upgrade-gke-1.0-current-release
413+
#
414+
# Test upgrades from the latest release-1.0 build to the latest current
415+
# release build.
416+
#
417+
# Configurations for step2, step4, and step6 live in the current release
418+
# branch.
419+
420+
kubernetes-upgrade-gke-1.0-current-release-step1-deploy)
421+
configure_upgrade_step 'ci/latest-1.0' 'configured-in-current-release-branch' 'upgrade-gke-1-0-current-release' 'kubernetes-jenkins-gke-upgrade'
422+
;;
423+
424+
kubernetes-upgrade-gke-1.0-current-release-step3-e2e-old)
425+
configure_upgrade_step 'ci/latest-1.0' 'configured-in-current-release-branch' 'upgrade-gke-1-0-current-release' 'kubernetes-jenkins-gke-upgrade'
426+
;;
427+
428+
kubernetes-upgrade-gke-1.0-current-release-step5-e2e-old)
429+
configure_upgrade_step 'ci/latest-1.0' 'configured-in-current-release-branch' 'upgrade-gke-1-0-current-release' 'kubernetes-jenkins-gke-upgrade'
430+
;;
431+
432+
# kubernetes-upgrade-gke-1.0-master
433+
#
434+
# Test upgrades from the latest release-1.0 build to the latest master build.
435+
#
436+
# Configurations for step2, step4, and step6 live in master.
437+
438+
kubernetes-upgrade-gke-1.0-master-step1-deploy)
439+
configure_upgrade_step 'ci/latest-1.0' 'configured-in-master' 'upgrade-gke-1-0-master' 'kubernetes-jenkins-gke-upgrade'
440+
;;
441+
442+
kubernetes-upgrade-gke-1.0-master-step3-e2e-old)
443+
configure_upgrade_step 'ci/latest-1.0' 'configured-in-master' 'upgrade-gke-1-0-master' 'kubernetes-jenkins-gke-upgrade'
444+
;;
445+
446+
kubernetes-upgrade-gke-1.0-master-step5-e2e-old)
447+
configure_upgrade_step 'ci/latest-1.0' 'configured-in-master' 'upgrade-gke-1-0-master' 'kubernetes-jenkins-gke-upgrade'
448+
;;
257449
esac
258450

259451
# AWS variables

0 commit comments

Comments
 (0)