@@ -34,7 +34,6 @@ ENABLE_PARAM_ENUM=${ENABLE_PARAM_ENUM:="false"}
3434ENABLE_ARTIFACTS=${ENABLE_ARTIFACTS:= " false" }
3535ENABLE_CONCISE_RESOLVER_SYNTAX=${ENABLE_CONCISE_RESOLVER_SYNTAX:= " false" }
3636ENABLE_KUBERNETES_SIDECAR=${ENABLE_KUBERNETES_SIDECAR:= " false" }
37- failed=0
3837
3938# Script entry point.
4039
@@ -49,7 +48,6 @@ install_pipeline_crd
4948export SYSTEM_NAMESPACE=tekton-pipelines
5049set +x
5150
52- failed=0
5351
5452function add_spire() {
5553 local gate=" $1 "
@@ -59,7 +57,6 @@ function add_spire() {
5957 install_spire
6058 patch_pipeline_spire
6159 kubectl apply -n tekton-pipelines -f " $DIR " /testdata/spire/config-spire.yaml
62- failed=0
6360 fi
6461}
6562
@@ -72,7 +69,7 @@ function set_feature_gate() {
7269 printf " Setting feature gate to %s\n" , ${gate}
7370 jsonpatch=$( printf " {\" data\" : {\" enable-api-fields\" : \" %s\" }}" $1 )
7471 echo " feature-flags ConfigMap patch: ${jsonpatch} "
75- kubectl patch configmap feature-flags -n tekton-pipelines -p " $jsonpatch "
72+ with_retries kubectl patch configmap feature-flags -n tekton-pipelines -p " $jsonpatch "
7673}
7774
7875function set_result_extraction_method() {
@@ -84,7 +81,7 @@ function set_result_extraction_method() {
8481 printf " Setting results-from to %s\n" , ${method}
8582 jsonpatch=$( printf " {\" data\" : {\" results-from\" : \" %s\" }}" $1 )
8683 echo " feature-flags ConfigMap patch: ${jsonpatch} "
87- kubectl patch configmap feature-flags -n tekton-pipelines -p " $jsonpatch "
84+ with_retries kubectl patch configmap feature-flags -n tekton-pipelines -p " $jsonpatch "
8885}
8986
9087function set_keep_pod_on_cancel() {
@@ -96,7 +93,7 @@ function set_keep_pod_on_cancel() {
9693 printf " Setting keep-pod-on-cancel to %s\n" , ${method}
9794 jsonpatch=$( printf " {\" data\" : {\" keep-pod-on-cancel\" : \" %s\" }}" $1 )
9895 echo " feature-flags ConfigMap patch: ${jsonpatch} "
99- kubectl patch configmap feature-flags -n tekton-pipelines -p " $jsonpatch "
96+ with_retries kubectl patch configmap feature-flags -n tekton-pipelines -p " $jsonpatch "
10097}
10198
10299function set_cel_in_whenexpression() {
@@ -107,7 +104,7 @@ function set_cel_in_whenexpression() {
107104 fi
108105 jsonpatch=$( printf " {\" data\" : {\" enable-cel-in-whenexpression\" : \" %s\" }}" $1 )
109106 echo " feature-flags ConfigMap patch: ${jsonpatch} "
110- kubectl patch configmap feature-flags -n tekton-pipelines -p " $jsonpatch "
107+ with_retries kubectl patch configmap feature-flags -n tekton-pipelines -p " $jsonpatch "
111108}
112109
113110function set_enable_param_enum() {
@@ -119,7 +116,7 @@ function set_enable_param_enum() {
119116 printf " Setting enable-param-enum to %s\n" , ${method}
120117 jsonpatch=$( printf " {\" data\" : {\" enable-param-enum\" : \" %s\" }}" $1 )
121118 echo " feature-flags ConfigMap patch: ${jsonpatch} "
122- kubectl patch configmap feature-flags -n tekton-pipelines -p " $jsonpatch "
119+ with_retries kubectl patch configmap feature-flags -n tekton-pipelines -p " $jsonpatch "
123120}
124121
125122function set_enable_artifacts() {
@@ -131,7 +128,7 @@ function set_enable_artifacts() {
131128 printf " Setting enable-artifacts to %s\n" , ${method}
132129 jsonpatch=$( printf " {\" data\" : {\" enable-artifacts\" : \" %s\" }}" $1 )
133130 echo " feature-flags ConfigMap patch: ${jsonpatch} "
134- kubectl patch configmap feature-flags -n tekton-pipelines -p " $jsonpatch "
131+ with_retries kubectl patch configmap feature-flags -n tekton-pipelines -p " $jsonpatch "
135132}
136133
137134function set_enable_concise_resolver_syntax() {
@@ -143,7 +140,7 @@ function set_enable_concise_resolver_syntax() {
143140 printf " Setting enable-concise-resolver-syntax to %s\n" , ${method}
144141 jsonpatch=$( printf " {\" data\" : {\" enable-concise-resolver-syntax\" : \" %s\" }}" $1 )
145142 echo " feature-flags ConfigMap patch: ${jsonpatch} "
146- kubectl patch configmap feature-flags -n tekton-pipelines -p " $jsonpatch "
143+ with_retries kubectl patch configmap feature-flags -n tekton-pipelines -p " $jsonpatch "
147144}
148145
149146function set_enable_kubernetes_sidecar() {
@@ -155,40 +152,43 @@ function set_enable_kubernetes_sidecar() {
155152 printf " Setting enable-kubernetes-sidecar to %s\n" , ${method}
156153 jsonpatch=$( printf " {\" data\" : {\" enable-kubernetes-sidecar\" : \" %s\" }}" $1 )
157154 echo " feature-flags ConfigMap patch: ${jsonpatch} "
158- kubectl patch configmap feature-flags -n tekton-pipelines -p " $jsonpatch "
155+ with_retries kubectl patch configmap feature-flags -n tekton-pipelines -p " $jsonpatch "
159156}
160157
161158function set_default_sidecar_log_polling_interval() {
162159 # Sets the default-sidecar-log-polling-interval in the config-defaults ConfigMap to 0ms for e2e tests
163160 echo " Patching config-defaults ConfigMap: setting default-sidecar-log-polling-interval to 0ms"
164161 jsonpatch=' {"data": {"default-sidecar-log-polling-interval": "0ms"}}'
165- kubectl patch configmap config-defaults -n tekton-pipelines -p " $jsonpatch "
162+ with_retries kubectl patch configmap config-defaults -n tekton-pipelines -p " $jsonpatch "
166163}
167164
168165function run_e2e() {
169166 # Run the integration tests
170167 header " Running Go e2e tests"
171168 # Skip ./test/*.go tests if SKIP_GO_E2E_TESTS == true
172169 if [ " ${SKIP_GO_E2E_TESTS} " != " true" ]; then
173- go_test_e2e -timeout=${E2E_GO_TEST_TIMEOUT} ./test/... || failed=1
170+ go_test_e2e -timeout=${E2E_GO_TEST_TIMEOUT} ./test/...
174171 fi
175172
176173 # Run these _after_ the integration tests b/c they don't quite work all the way
177174 # and they cause a lot of noise in the logs, making it harder to debug integration
178175 # test failures.
179176 if [ " ${RUN_YAML_TESTS} " == " true" ]; then
180- go_test_e2e -mod=readonly -tags=examples -timeout=${E2E_GO_TEST_TIMEOUT} ./test/ || failed=1
177+ go_test_e2e -mod=readonly -tags=examples -timeout=${E2E_GO_TEST_TIMEOUT} ./test/
181178 fi
182179
183180 if [ " ${RUN_FEATUREFLAG_TESTS} " == " true" ]; then
184- go_test_e2e -mod=readonly -tags=featureflags -timeout=${E2E_GO_TEST_TIMEOUT} ./test/ || failed=1
181+ go_test_e2e -mod=readonly -tags=featureflags -timeout=${E2E_GO_TEST_TIMEOUT} ./test/
185182 fi
186183}
187184
185+ set -eo pipefail
186+ trap ' [[ "$?" == "0" ]] || fail_test' EXIT
187+
188188add_spire " $PIPELINE_FEATURE_GATE "
189189set_feature_gate " $PIPELINE_FEATURE_GATE "
190190set_result_extraction_method " $RESULTS_FROM "
191- set_keep_pod_on_cancel " $KEEP_POD_ON_CANCEL "
191+ set_keep_pod_on_cancel " $KEEP_POD_ON_CANCEL "
192192set_cel_in_whenexpression " $ENABLE_CEL_IN_WHENEXPRESSION "
193193set_enable_param_enum " $ENABLE_PARAM_ENUM "
194194set_enable_artifacts " $ENABLE_ARTIFACTS "
@@ -197,5 +197,4 @@ set_enable_kubernetes_sidecar "$ENABLE_KUBERNETES_SIDECAR"
197197set_default_sidecar_log_polling_interval
198198run_e2e
199199
200- (( failed )) && fail_test
201200success
0 commit comments