From dfedc43cf394f3a268c30986fcb0bc827672f6f5 Mon Sep 17 00:00:00 2001 From: Tiger Kaovilai Date: Wed, 6 Nov 2024 11:44:06 -0500 Subject: [PATCH 1/2] Dynamic Kind Versions for e2e Always test latest available patch version of each supported k8s version available in Kindest/node images. ie. This adds v1.31, v1.30 to test matrix and upgrade patch versions for others. Signed-off-by: Tiger Kaovilai --- .github/workflows/e2e-test-kind.yaml | 44 ++++++++++++++++++---------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/.github/workflows/e2e-test-kind.yaml b/.github/workflows/e2e-test-kind.yaml index 608cdc50e8..779a5504d9 100644 --- a/.github/workflows/e2e-test-kind.yaml +++ b/.github/workflows/e2e-test-kind.yaml @@ -44,26 +44,38 @@ jobs: run: | IMAGE=velero VERSION=pr-test make container docker save velero:pr-test -o ./velero.tar + # Create json of k8s versions to test + # from guide: https://stackoverflow.com/a/65094398/4590470 + setup-test-matrix: + runs-on: ubuntu-latest + env: + GH_TOKEN: ${{ github.token }} + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + steps: + - name: Set k8s versions + id: set-matrix + # everything excluding older tags below 1.23. limits needs to be high enough to cover all latest versions + # and test labels + # grep -E "v[1-9]\.(2[3-9]|[3-9][0-9])" filters for v1.23 to v9.99 + run: | + echo "matrix={\ + \"k8s\":$(wget -q -O - "https://hub.docker.com/v2/namespaces/kindest/repositories/node/tags?page_size=50" | grep -o '"name": *"[^"]*' | grep -o '[^"]*$' | grep -v -E "alpha|beta" | grep -E "v[1-9]\.(2[3-9]|[3-9][0-9])" | awk -F. '{if(!a[$1"."$2]++)print $1"."$2"."$NF}' | sort -r | sed s/v//g | jq -R -c -s 'split("\n")[:-1]'),\ + \"labels\":[\ + \"Basic && (ClusterResource || NodePort || StorageClass)\", \ + \"ResourceFiltering && !Restic\", \ + \"ResourceModifier || (Backups && BackupsSync) || PrivilegesMgmt || OrderedResources\", \ + \"(NamespaceMapping && Single && Restic) || (NamespaceMapping && Multiple && Restic)\"\ + ]}" >> $GITHUB_OUTPUT + # Run E2E test against all Kubernetes versions on kind run-e2e-test: - needs: build + needs: + - build + - setup-test-matrix runs-on: ubuntu-latest strategy: - matrix: - k8s: - - 1.23.17 - - 1.24.17 - - 1.25.16 - - 1.26.13 - - 1.27.10 - - 1.28.6 - - 1.29.1 - labels: - # labels are used to filter running E2E cases - - Basic && (ClusterResource || NodePort || StorageClass) - - ResourceFiltering && !Restic - - ResourceModifier || (Backups && BackupsSync) || PrivilegesMgmt || OrderedResources - - (NamespaceMapping && Single && Restic) || (NamespaceMapping && Multiple && Restic) + matrix: ${{fromJson(needs.setup-test-matrix.outputs.matrix)}} fail-fast: false steps: - name: Check out the code From f200f8fe49498f6e7e25aec1d2d0bb7a928d42b4 Mon Sep 17 00:00:00 2001 From: Tiger Kaovilai Date: Fri, 8 Nov 2024 13:44:55 +0000 Subject: [PATCH 2/2] Remove 1.23, 1.24 from matrix Signed-off-by: Tiger Kaovilai --- .github/workflows/e2e-test-kind.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/e2e-test-kind.yaml b/.github/workflows/e2e-test-kind.yaml index 779a5504d9..6df789f894 100644 --- a/.github/workflows/e2e-test-kind.yaml +++ b/.github/workflows/e2e-test-kind.yaml @@ -55,12 +55,14 @@ jobs: steps: - name: Set k8s versions id: set-matrix - # everything excluding older tags below 1.23. limits needs to be high enough to cover all latest versions + # everything excluding older tags. limits needs to be high enough to cover all latest versions # and test labels - # grep -E "v[1-9]\.(2[3-9]|[3-9][0-9])" filters for v1.23 to v9.99 + # grep -E "v[1-9]\.(2[5-9]|[3-9][0-9])" filters for v1.25 to v9.99 + # and removes older patches of the same minor version + # awk -F. '{if(!a[$1"."$2]++)print $1"."$2"."$NF}' run: | echo "matrix={\ - \"k8s\":$(wget -q -O - "https://hub.docker.com/v2/namespaces/kindest/repositories/node/tags?page_size=50" | grep -o '"name": *"[^"]*' | grep -o '[^"]*$' | grep -v -E "alpha|beta" | grep -E "v[1-9]\.(2[3-9]|[3-9][0-9])" | awk -F. '{if(!a[$1"."$2]++)print $1"."$2"."$NF}' | sort -r | sed s/v//g | jq -R -c -s 'split("\n")[:-1]'),\ + \"k8s\":$(wget -q -O - "https://hub.docker.com/v2/namespaces/kindest/repositories/node/tags?page_size=50" | grep -o '"name": *"[^"]*' | grep -o '[^"]*$' | grep -v -E "alpha|beta" | grep -E "v[1-9]\.(2[5-9]|[3-9][0-9])" | awk -F. '{if(!a[$1"."$2]++)print $1"."$2"."$NF}' | sort -r | sed s/v//g | jq -R -c -s 'split("\n")[:-1]'),\ \"labels\":[\ \"Basic && (ClusterResource || NodePort || StorageClass)\", \ \"ResourceFiltering && !Restic\", \