Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: use also different K8s versions for E2E testing in GHA #659

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,25 @@ jobs:
fi

test:
name: Test against Py ${{ matrix.python }}
name: Test against Py ${{ matrix.python }} and K8s ${{ matrix.kubernetes-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: ["3.12", "3.11", "3.10", "3.9"]
python: ["3.12"] # see below for versions 3.9-3.11
kubernetes-version: ["v1.27.11", "v1.28.7", "v1.29.2", "v1.30.6", "v1.31.0"]
exclude: # on main merges (not PRs), use also different K8s versions for E2E testing
- kubernetes-version: ${{ github.event_name != 'push' && 'v1.28.7' }}
- kubernetes-version: ${{ github.event_name != 'push' && 'v1.29.2' }}
- kubernetes-version: ${{ github.event_name != 'push' && 'v1.30.6' }}
Comment on lines +77 to +79
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not know you could add such "boolean" conditions on the exclude, really interesting!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a neat trick I discovered recently, but the "limitation" is that the order will always be 1. Exclusion, 2. Inclusion

So there is only so much can be done in 1 matrix

For more complex cases, the solution would be to produce the matrix in one job, and consume in another job--that's what also GHA docs advise in general

For this case, this was compact enough imho

- kubernetes-version: ${{ github.event_name != 'push' && 'v1.31.0' }}
include: # test Py versions only with a reference K8s version, designated currently to kubernetes-version: v1.27.11
- python: "3.11"
kubernetes-version: "v1.27.11"
- python: "3.10"
kubernetes-version: "v1.27.11"
- python: "3.9"
kubernetes-version: "v1.27.11"
env:
FORCE_COLOR: "1"
IMG_ORG: kubeflow
Expand Down Expand Up @@ -124,8 +137,9 @@ jobs:
- name: Start Kind Cluster
uses: helm/[email protected]
with:
node_image: "kindest/node:v1.27.11"
node_image: kindest/node:${{ matrix.kubernetes-version }}
cluster_name: chart-testing-py-${{ matrix.python }}
kubectl_version: ${{ matrix.kubernetes-version }}
- name: Load Local Registry Test Image
env:
IMG: "${{ env.IMG_ORG }}/${{ env.IMG_REPO }}:${{ steps.tags.outputs.tag }}"
Expand Down
Loading