@@ -192,13 +192,18 @@ function e2e_test() {
192
192
echo " Publish version to ci/latest-green.txt: $( cat version) "
193
193
gsutil cp ./version gs://kubernetes-release/ci/latest-green.txt
194
194
fi
195
+ return ${exitcode}
195
196
}
196
197
197
198
echo " --------------------------------------------------------------------------------"
198
199
echo " Test Environment:"
199
200
printenv | sort
200
201
echo " --------------------------------------------------------------------------------"
201
202
203
+ # Set this var instead of exiting-- we must do the cluster teardown step. We'll
204
+ # return this at the very end.
205
+ EXIT_CODE=0
206
+
202
207
# We get the Kubernetes tarballs unless we are going to use old ones
203
208
if [[ " ${JENKINS_USE_EXISTING_BINARIES:- } " =~ ^[yY]$ ]]; then
204
209
echo " Using existing binaries; not cleaning, fetching, or unpacking new ones."
@@ -329,7 +334,7 @@ if [[ -n "${JENKINS_PUBLISHED_SKEW_VERSION:-}" ]]; then
329
334
if [[ " ${E2E_UPGRADE_TEST:- } " == " true" ]]; then
330
335
# Add a report prefix for the e2e tests so that the tests don't get overwritten when we run
331
336
# the rest of the e2es.
332
- E2E_REPORT_PREFIX=' upgrade' e2e_test " ${GINKGO_UPGRADE_TEST_ARGS:- } "
337
+ E2E_REPORT_PREFIX=' upgrade' e2e_test " ${GINKGO_UPGRADE_TEST_ARGS:- } " || EXIT_CODE=1
333
338
fi
334
339
if [[ " ${JENKINS_USE_SKEW_TESTS:- } " != " true" ]]; then
335
340
# Back out into the old tests now that we've downloaded & maybe upgraded.
@@ -344,7 +349,7 @@ if [[ -n "${JENKINS_PUBLISHED_SKEW_VERSION:-}" ]]; then
344
349
fi
345
350
346
351
if [[ " ${E2E_TEST,,} " == " true" ]]; then
347
- e2e_test " ${GINKGO_TEST_ARGS:- } "
352
+ e2e_test " ${GINKGO_TEST_ARGS:- } " || EXIT_CODE=1
348
353
fi
349
354
350
355
# ## Start Kubemark ###
@@ -362,6 +367,8 @@ if [[ "${USE_KUBEMARK:-}" == "true" ]]; then
362
367
# junit.xml results for test failures and not process the exit code. This is needed by jenkins to more gracefully
363
368
# handle blocking the merge queue as a result of test failure flakes. Infrastructure failures should continue to
364
369
# exit non-0.
370
+ # TODO: The above comment is no longer accurate. Need to fix this before
371
+ # turning xunit off for the postsubmit tests. See: #28200
365
372
./test/kubemark/run-e2e-tests.sh --ginkgo.focus=" ${KUBEMARK_TESTS:- starting\s 30\s pods} " " ${KUBEMARK_TEST_ARGS:- } " || dump_cluster_logs
366
373
./test/kubemark/stop-kubemark.sh
367
374
NUM_NODES=${NUM_NODES_BKP}
@@ -394,6 +401,8 @@ if [[ "${E2E_UP:-}" == "${E2E_DOWN:-}" && -f "${gcp_resources_before}" && -f "${
394
401
if [[ -n $( echo " ${difference} " | tail -n +3 | grep -E " ^\+" ) ]] && [[ " ${FAIL_ON_GCP_RESOURCE_LEAK:- } " == " true" ]]; then
395
402
echo " ${difference} "
396
403
echo " !!! FAIL: Google Cloud Platform resources leaked while running tests!"
397
- exit 1
404
+ EXIT_CODE= 1
398
405
fi
399
406
fi
407
+
408
+ exit ${EXIT_CODE}
0 commit comments