From 6756f356ce8966e9f583bb12e7c316c7cfe64713 Mon Sep 17 00:00:00 2001 From: pvannierop Date: Wed, 22 Jan 2025 10:40:00 +0100 Subject: [PATCH] Fix k3d version matrix --- .github/workflows/matrix_includes.json | 12 ++++++++++++ .github/workflows/push.yaml | 21 +++++++++++++-------- 2 files changed, 25 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/matrix_includes.json diff --git a/.github/workflows/matrix_includes.json b/.github/workflows/matrix_includes.json new file mode 100644 index 000000000..a1775fffd --- /dev/null +++ b/.github/workflows/matrix_includes.json @@ -0,0 +1,12 @@ +[ + { + "KUBECTL_VERSION": "v1.30.0", + "K3S_VERSION": "v1.30.6+k3s1", + "runOnBranch": "main" + }, + { + "KUBECTL_VERSION": "v1.31.0", + "K3S_VERSION": "v1.31.2+k3s1", + "runOnBranch": "always" + } +] \ No newline at end of file diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index 19048d155..3bd4d3ba4 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -73,18 +73,23 @@ jobs: run: | k3d cluster delete --all || true + matrix-prep: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + steps: + - uses: nelonoel/branch-name@v1.0.1 + - id: set-matrix + uses: JoshuaTheMiller/conditional-build-matrix@main + with: +# inputFile: .github/workflows/matrix_includes.json + filter: '[?runOnBranch==`${{ env.BRANCH_NAME }}` || runOnBranch==`always`]' + test-k8s-versions: needs: delete-old-clusters runs-on: self-hosted strategy: - matrix: - KUBECTL_VERSION: [ "v1.30.0", "v1.31.0" ] - include: - - KUBECTL_VERSION: "v1.31.0" - K3S_VERSION: "v1.31.2+k3s1" - exclude: - - KUBECTL_VERSION: ${{ github.base_ref != 'refs/heads/main' && 'v1.30.0' }} - K3S_VERSION: ${{ github.base_ref != 'refs/heads/main' && 'v1.30.6+k3s1' }} + matrix: ${{ fromJson(needs.matrix_prep.outputs.matrix) }} steps: - uses: nolar/setup-k3d-k3s@v1 with: