@@ -39,7 +39,7 @@ capi:buildDockerImages () {
39
39
# depending on what is set in GINKGO_LABEL_FILTER.
40
40
# Note: We do this to ensure that the kindest/node image gets built if it does
41
41
# not already exist, e.g. for pre-releases, but only if necessary.
42
- k8s::prepareKindestImagesVariables () {
42
+ k8s::prepareKindestImagesVariablesGingkoFilters () {
43
43
# Always default KUBERNETES_VERSION_MANAGEMENT because we always create a management cluster out of it.
44
44
if [[ -z " ${KUBERNETES_VERSION_MANAGEMENT:- } " ]]; then
45
45
KUBERNETES_VERSION_MANAGEMENT=$( grep KUBERNETES_VERSION_MANAGEMENT: < " $E2E_CONF_FILE " | awk -F' "' ' { print $2}' )
@@ -65,7 +65,7 @@ k8s::prepareKindestImagesVariables() {
65
65
66
66
# Tests not focusing on anything and skipping [Conformance] run a clusterctl upgrade test
67
67
# on the latest kubernetes version as management cluster.
68
- if [[ ${GINKGO_LABEL_FILTER:- } == " " ]] && [[ ${GINKGO_LABEL_FILTER} == * " !Conformance" * ]]; then
68
+ if [[ ${GINKGO_LABEL_FILTER} =~ ^ ! Conformance$ ]]; then
69
69
# Note: We do this because we want to specify KUBERNETES_VERSION_LATEST_CI *only* in the e2e config.
70
70
if [[ -z " ${KUBERNETES_VERSION_LATEST_CI:- } " ]]; then
71
71
KUBERNETES_VERSION_LATEST_CI=$( grep KUBERNETES_VERSION_LATEST_CI: < " $E2E_CONF_FILE " | awk -F' "' ' { print $2}' )
@@ -88,6 +88,60 @@ k8s::prepareKindestImagesVariables() {
88
88
fi
89
89
}
90
90
91
+ # k8s::prepareKindestImagesVariables defaults the environment variables KUBERNETES_VERSION_MANAGEMENT, KUBERNETES_VERSION,
92
+ # KUBERNETES_VERSION_UPGRADE_TO, KUBERNETES_VERSION_UPGRADE_FROM and KUBERNETES_VERSION_LATEST_CI
93
+ # depending on what is set in GINKGO_FOCUS.
94
+ # Note: We do this to ensure that the kindest/node image gets built if it does
95
+ # not already exist, e.g. for pre-releases, but only if necessary.
96
+ k8s::prepareKindestImagesVariables () {
97
+ # Always default KUBERNETES_VERSION_MANAGEMENT because we always create a management cluster out of it.
98
+ if [[ -z " ${KUBERNETES_VERSION_MANAGEMENT:- } " ]]; then
99
+ KUBERNETES_VERSION_MANAGEMENT=$( grep KUBERNETES_VERSION_MANAGEMENT: < " $E2E_CONF_FILE " | awk -F' "' ' { print $2}' )
100
+ echo " Defaulting KUBERNETES_VERSION_MANAGEMENT to ${KUBERNETES_VERSION_MANAGEMENT} to trigger image build (because env var is not set)"
101
+ fi
102
+
103
+ if [[ ${GINKGO_FOCUS:- } == * " K8s-Install-ci-latest" * ]]; then
104
+ # If the test focuses on [K8s-Install-ci-latest], only default KUBERNETES_VERSION_LATEST_CI
105
+ # to the value in the e2e config and only if it is not set.
106
+ # Note: We do this because we want to specify KUBERNETES_VERSION_LATEST_CI *only* in the e2e config.
107
+ if [[ -z " ${KUBERNETES_VERSION_LATEST_CI:- } " ]]; then
108
+ KUBERNETES_VERSION_LATEST_CI=$( grep KUBERNETES_VERSION_LATEST_CI: < " $E2E_CONF_FILE " | awk -F' "' ' { print $2}' )
109
+ echo " Defaulting KUBERNETES_VERSION_LATEST_CI to ${KUBERNETES_VERSION_LATEST_CI} to trigger image build (because env var is not set)"
110
+ fi
111
+ elif [[ ${GINKGO_FOCUS:- } != * " K8s-Upgrade" * ]]; then
112
+ # In any other case which is not [K8s-Upgrade], default KUBERNETES_VERSION if it is not set to make sure
113
+ # the corresponding kindest/node image exists.
114
+ if [[ -z " ${KUBERNETES_VERSION:- } " ]]; then
115
+ KUBERNETES_VERSION=$( grep KUBERNETES_VERSION: < " $E2E_CONF_FILE " | awk -F' "' ' { print $2}' )
116
+ echo " Defaulting KUBERNETES_VERSION to ${KUBERNETES_VERSION} to trigger image build (because env var is not set)"
117
+ fi
118
+ fi
119
+
120
+ # Tests not focusing on anything and skipping [Conformance] run a clusterctl upgrade test
121
+ # on the latest kubernetes version as management cluster.
122
+ if [[ ${GINKGO_FOCUS:- } == " " ]] && [[ ${GINKGO_SKIP} == * " Conformance" * ]]; then
123
+ # Note: We do this because we want to specify KUBERNETES_VERSION_LATEST_CI *only* in the e2e config.
124
+ if [[ -z " ${KUBERNETES_VERSION_LATEST_CI:- } " ]]; then
125
+ KUBERNETES_VERSION_LATEST_CI=$( grep KUBERNETES_VERSION_LATEST_CI: < " $E2E_CONF_FILE " | awk -F' "' ' { print $2}' )
126
+ echo " Defaulting KUBERNETES_VERSION_LATEST_CI to ${KUBERNETES_VERSION_LATEST_CI} to trigger image build (because env var is not set)"
127
+ fi
128
+ fi
129
+
130
+ # Tests not focusing on [PR-Blocking], [K8s-Install] or [K8s-Install-ci-latest],
131
+ # also run upgrade tests so default KUBERNETES_VERSION_UPGRADE_TO and KUBERNETES_VERSION_UPGRADE_FROM
132
+ # to the value in the e2e config if they are not set.
133
+ if [[ ${GINKGO_FOCUS:- } != * " PR-Blocking" * ]] && [[ ${GINKGO_FOCUS:- } != * " K8s-Install" * ]]; then
134
+ if [[ -z " ${KUBERNETES_VERSION_UPGRADE_TO:- } " ]]; then
135
+ KUBERNETES_VERSION_UPGRADE_TO=$( grep KUBERNETES_VERSION_UPGRADE_TO: < " $E2E_CONF_FILE " | awk -F' "' ' { print $2}' )
136
+ echo " Defaulting KUBERNETES_VERSION_UPGRADE_TO to ${KUBERNETES_VERSION_UPGRADE_TO} to trigger image build (because env var is not set)"
137
+ fi
138
+ if [[ -z " ${KUBERNETES_VERSION_UPGRADE_FROM:- } " ]]; then
139
+ KUBERNETES_VERSION_UPGRADE_FROM=$( grep KUBERNETES_VERSION_UPGRADE_FROM: < " $E2E_CONF_FILE " | awk -F' "' ' { print $2}' )
140
+ echo " Defaulting KUBERNETES_VERSION_UPGRADE_FROM to ${KUBERNETES_VERSION_UPGRADE_FROM} to trigger image build (because env var is not set)"
141
+ fi
142
+ fi
143
+ }
144
+
91
145
# k8s::prepareKindestImages checks all the e2e test variables representing a Kubernetes version,
92
146
# and makes sure a corresponding kindest/node image is available locally.
93
147
k8s::prepareKindestImages () {
0 commit comments