Skip to content

Commit a396d12

Browse files
committed
fix: make compatibility versions test use dynamic n-1 branch for test (from hardcoded release-1.31)
1 parent 1936263 commit a396d12

File tree

2 files changed

+15
-18
lines changed

2 files changed

+15
-18
lines changed

config/jobs/kubernetes/sig-testing/compatibility-versions-e2e.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ periodics:
3535
- -c
3636
- curl -sSL https://kind.sigs.k8s.io/dl/latest/linux-amd64.tgz | tar xvfz - -C "${PATH%%:*}/" && ./../test-infra/experiment/compatibility-versions/e2e-k8s-compatibility-versions.sh
3737
env:
38-
- name: EMULATED_VERSION
39-
value: "1.31" # TODO(aaron-prindle) FIXME - hardcoded for now
4038
- name: SKIP
4139
value: Alpha|Disruptive|Slow|Flaky|IPv6|LoadBalancer|PodSecurityPolicy|nfs
4240
- name: PARALLEL

experiment/compatibility-versions/e2e-k8s-compatibility-versions.sh

+15-16
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,6 @@ EOF
223223

224224
# run e2es with ginkgo-e2e.sh
225225
run_tests() {
226-
# Change to the cloned Kubernetes repository
227-
pushd ../kubernetes
228-
229226
# IPv6 clusters need some CoreDNS changes in order to work in k8s CI:
230227
# 1. k8s CI doesn´t offer IPv6 connectivity, so CoreDNS should be configured
231228
# to work in an offline environment:
@@ -286,17 +283,6 @@ run_tests() {
286283
"--report-dir=${ARTIFACTS}" '--disable-log-dump=true' &
287284
GINKGO_PID=$!
288285
wait "$GINKGO_PID"
289-
290-
# Return to the original directory
291-
popd
292-
}
293-
294-
# clone kubernetes repo for specific release branch
295-
clone_kubernetes_release() {
296-
# Clone the specific Kubernetes release branch
297-
# Replace "release-1.31" with the desired branch
298-
KUBE_RELEASE_BRANCH=${KUBE_RELEASE_BRANCH:-release-1.31}
299-
git clone --single-branch --branch "${KUBE_RELEASE_BRANCH}" https://github.com/kubernetes/kubernetes.git
300286
}
301287

302288
main() {
@@ -307,6 +293,13 @@ main() {
307293
export ARTIFACTS="${ARTIFACTS:-${PWD}/_artifacts}"
308294
mkdir -p "${ARTIFACTS}"
309295

296+
# Get current and n-1 version numbers
297+
MAJOR_VERSION=$(./hack/print-workspace-status.sh | awk '/STABLE_BUILD_MAJOR_VERSION/ {print $2}')
298+
MINOR_VERSION=$(./hack/print-workspace-status.sh | awk '/STABLE_BUILD_MINOR_VERSION/ {split($2, minor, "+"); print minor[1]}')
299+
export CURRENT_VERSION="${MAJOR_VERSION}.${MINOR_VERSION}"
300+
export N_MINUS_ONE_VERSION="${MAJOR_VERSION}.$((MINOR_VERSION - 1))"
301+
export EMULATED_VERSION=$(N_MINUS_ONE_VERSION)
302+
310303
# export the KUBECONFIG to a unique path for testing
311304
KUBECONFIG="${HOME}/.kube/kind-test-config"
312305
export KUBECONFIG
@@ -327,10 +320,16 @@ main() {
327320
res=0
328321
create_cluster || res=$?
329322

330-
# Clone the specific Kubernetes release branch
331-
clone_kubernetes_release
323+
# Clone the previous versions Kubernetes release branch
324+
# TODO(aaron-prindle) extend the branches to test from n-1 -> n-1..3 as more k8s releases are done that support compatibility versions
325+
export PREV_RELEASE_BRANCH="release-${EMULATED_VERSION}"
326+
git clone --filter=blob:none --single-branch --branch "${PREV_RELEASE_BRANCH}" https://github.com/kubernetes/kubernetes.git "${PREV_RELEASE_BRANCH}"
332327

328+
# enter the release branch and run tests
329+
pushd "${PREV_RELEASE_BRANCH}"
333330
run_tests || res=$?
331+
popd
332+
334333
cleanup || res=$?
335334
exit $res
336335
}

0 commit comments

Comments
 (0)