diff --git a/config/jobs/kubernetes/sig-testing/compatibility-versions-e2e.yaml b/config/jobs/kubernetes/sig-testing/compatibility-versions-e2e.yaml index 34e540290e0a..1c42bed756ac 100644 --- a/config/jobs/kubernetes/sig-testing/compatibility-versions-e2e.yaml +++ b/config/jobs/kubernetes/sig-testing/compatibility-versions-e2e.yaml @@ -35,8 +35,6 @@ periodics: - -c - 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 env: - - name: EMULATED_VERSION - value: "1.31" # TODO(aaron-prindle) FIXME - hardcoded for now - name: SKIP value: Alpha|Disruptive|Slow|Flaky|IPv6|LoadBalancer|PodSecurityPolicy|nfs - name: PARALLEL diff --git a/experiment/compatibility-versions/e2e-k8s-compatibility-versions.sh b/experiment/compatibility-versions/e2e-k8s-compatibility-versions.sh index cd863925f514..bd663a822ab2 100755 --- a/experiment/compatibility-versions/e2e-k8s-compatibility-versions.sh +++ b/experiment/compatibility-versions/e2e-k8s-compatibility-versions.sh @@ -223,9 +223,6 @@ EOF # run e2es with ginkgo-e2e.sh run_tests() { - # Change to the cloned Kubernetes repository - pushd ../kubernetes - # IPv6 clusters need some CoreDNS changes in order to work in k8s CI: # 1. k8s CI doesn´t offer IPv6 connectivity, so CoreDNS should be configured # to work in an offline environment: @@ -286,17 +283,6 @@ run_tests() { "--report-dir=${ARTIFACTS}" '--disable-log-dump=true' & GINKGO_PID=$! wait "$GINKGO_PID" - - # Return to the original directory - popd -} - -# clone kubernetes repo for specific release branch -clone_kubernetes_release() { - # Clone the specific Kubernetes release branch - # Replace "release-1.31" with the desired branch - KUBE_RELEASE_BRANCH=${KUBE_RELEASE_BRANCH:-release-1.31} - git clone --single-branch --branch "${KUBE_RELEASE_BRANCH}" https://github.com/kubernetes/kubernetes.git } main() { @@ -307,6 +293,13 @@ main() { export ARTIFACTS="${ARTIFACTS:-${PWD}/_artifacts}" mkdir -p "${ARTIFACTS}" + # Get current and n-1 version numbers + MAJOR_VERSION=$(./hack/print-workspace-status.sh | awk '/STABLE_BUILD_MAJOR_VERSION/ {print $2}') + MINOR_VERSION=$(./hack/print-workspace-status.sh | awk '/STABLE_BUILD_MINOR_VERSION/ {split($2, minor, "+"); print minor[1]}') + export CURRENT_VERSION="${MAJOR_VERSION}.${MINOR_VERSION}" + export N_MINUS_ONE_VERSION="${MAJOR_VERSION}.$((MINOR_VERSION - 1))" + export EMULATED_VERSION=$(N_MINUS_ONE_VERSION) + # export the KUBECONFIG to a unique path for testing KUBECONFIG="${HOME}/.kube/kind-test-config" export KUBECONFIG @@ -327,10 +320,16 @@ main() { res=0 create_cluster || res=$? - # Clone the specific Kubernetes release branch - clone_kubernetes_release + # Clone the previous versions Kubernetes release branch + # TODO(aaron-prindle) extend the branches to test from n-1 -> n-1..3 as more k8s releases are done that support compatibility versions + export PREV_RELEASE_BRANCH="release-${EMULATED_VERSION}" + git clone --filter=blob:none --single-branch --branch "${PREV_RELEASE_BRANCH}" https://github.com/kubernetes/kubernetes.git "${PREV_RELEASE_BRANCH}" + # enter the release branch and run tests + pushd "${PREV_RELEASE_BRANCH}" run_tests || res=$? + popd + cleanup || res=$? exit $res }