@@ -44,26 +44,40 @@ jobs:
44
44
run : |
45
45
IMAGE=velero VERSION=pr-test make container
46
46
docker save velero:pr-test -o ./velero.tar
47
+ # Create json of k8s versions to test
48
+ # from guide: https://stackoverflow.com/a/65094398/4590470
49
+ setup-test-matrix :
50
+ runs-on : ubuntu-latest
51
+ env :
52
+ GH_TOKEN : ${{ github.token }}
53
+ outputs :
54
+ matrix : ${{ steps.set-matrix.outputs.matrix }}
55
+ steps :
56
+ - name : Set k8s versions
57
+ id : set-matrix
58
+ # everything excluding older tags. limits needs to be high enough to cover all latest versions
59
+ # and test labels
60
+ # grep -E "v[1-9]\.(2[5-9]|[3-9][0-9])" filters for v1.25 to v9.99
61
+ # and removes older patches of the same minor version
62
+ # awk -F. '{if(!a[$1"."$2]++)print $1"."$2"."$NF}'
63
+ run : |
64
+ echo "matrix={\
65
+ \"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]'),\
66
+ \"labels\":[\
67
+ \"Basic && (ClusterResource || NodePort || StorageClass)\", \
68
+ \"ResourceFiltering && !Restic\", \
69
+ \"ResourceModifier || (Backups && BackupsSync) || PrivilegesMgmt || OrderedResources\", \
70
+ \"(NamespaceMapping && Single && Restic) || (NamespaceMapping && Multiple && Restic)\"\
71
+ ]}" >> $GITHUB_OUTPUT
72
+
47
73
# Run E2E test against all Kubernetes versions on kind
48
74
run-e2e-test :
49
- needs : build
75
+ needs :
76
+ - build
77
+ - setup-test-matrix
50
78
runs-on : ubuntu-latest
51
79
strategy :
52
- matrix :
53
- k8s :
54
- - 1.23.17
55
- - 1.24.17
56
- - 1.25.16
57
- - 1.26.13
58
- - 1.27.10
59
- - 1.28.6
60
- - 1.29.1
61
- labels :
62
- # labels are used to filter running E2E cases
63
- - Basic && (ClusterResource || NodePort || StorageClass)
64
- - ResourceFiltering && !Restic
65
- - ResourceModifier || (Backups && BackupsSync) || PrivilegesMgmt || OrderedResources
66
- - (NamespaceMapping && Single && Restic) || (NamespaceMapping && Multiple && Restic)
80
+ matrix : ${{fromJson(needs.setup-test-matrix.outputs.matrix)}}
67
81
fail-fast : false
68
82
steps :
69
83
- name : Check out the code
0 commit comments