Skip to content

Commit 2ea7f98

Browse files
authored
ci: dynamic kong version matrix (#522)
1 parent 17f330c commit 2ea7f98

3 files changed

Lines changed: 59 additions & 24 deletions

File tree

.github/workflows/integration-test-enterprise.yaml

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,34 @@ jobs:
3131
echo "ok=true" >> $GITHUB_OUTPUT
3232
fi
3333
34+
# NOTE: This should be done in a workflow which runs on schedule and updates
35+
# the supported versions in a file in this repository.
36+
# This would save unexpected changes in CI matrix where an unrelated change
37+
# in the supported versions would block a PR from merging.
38+
# This is still better than maintaining the hardcoded matrix of versions in the workflow itself.
39+
supported-kong-versions:
40+
timeout-minutes: ${{ fromJSON(vars.GHA_DEFAULT_TIMEOUT) }}
41+
outputs:
42+
result: ${{ steps.result.outputs.versions }}
43+
runs-on: ubuntu-latest
44+
steps:
45+
- uses: actions/checkout@v4
46+
- id: result
47+
run: |
48+
{
49+
echo 'versions<<EOF'
50+
make kong.supported-versions
51+
echo EOF
52+
} >> "$GITHUB_OUTPUT"
53+
- run: |
54+
echo "Kong versions: ${{ steps.result.outputs.versions }}"
55+
3456
test-enterprise:
3557
timeout-minutes: ${{ fromJSON(vars.GHA_DEFAULT_TIMEOUT) }}
3658
continue-on-error: true
3759
needs:
3860
- secret-available
61+
- supported-kong-versions
3962
if: needs.secret-available.outputs.ok
4063
strategy:
4164
matrix:
@@ -48,18 +71,7 @@ jobs:
4871
router_flavor:
4972
- 'traditional_compatible'
5073
- 'expressions'
51-
kong_version:
52-
- '2.8'
53-
- '3.0'
54-
- '3.1'
55-
- '3.2'
56-
- '3.3'
57-
- '3.4'
58-
- '3.5'
59-
- '3.6'
60-
- '3.7'
61-
- '3.8'
62-
- '3.9'
74+
kong_version: ${{ fromJSON(needs.supported-kong-versions.outputs.result) }}
6375
env:
6476
KONG_ROUTER_FLAVOR: ${{ matrix.router_flavor }}
6577
KONG_IMAGE_TAG: ${{ matrix.kong_version }}

.github/workflows/integration-test.yaml

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,32 @@ on:
1616
- '*'
1717

1818
jobs:
19+
# NOTE: This should be done in a workflow which runs on schedule and updates
20+
# the supported versions in a file in this repository.
21+
# This would save unexpected changes in CI matrix where an unrelated change
22+
# in the supported versions would block a PR from merging.
23+
# This is still better than maintaining the hardcoded matrix of versions in the workflow itself.
24+
supported-kong-versions:
25+
timeout-minutes: ${{ fromJSON(vars.GHA_DEFAULT_TIMEOUT) }}
26+
outputs:
27+
result: ${{ steps.result.outputs.versions }}
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/checkout@v4
31+
- id: result
32+
run: |
33+
{
34+
echo 'versions<<EOF'
35+
make kong.supported-versions
36+
echo EOF
37+
} >> "$GITHUB_OUTPUT"
38+
- run: |
39+
echo "Kong versions: ${{ steps.result.outputs.versions }}"
40+
1941
test:
2042
timeout-minutes: ${{ fromJSON(vars.GHA_DEFAULT_TIMEOUT) }}
43+
needs:
44+
- supported-kong-versions
2145
strategy:
2246
matrix:
2347
# Skip explicitly to avoid spawning many unnecessary jobs,
@@ -32,18 +56,7 @@ jobs:
3256
router_flavor:
3357
- 'traditional_compatible'
3458
- 'expressions'
35-
kong_version:
36-
- '2.8'
37-
- '3.0'
38-
- '3.1'
39-
- '3.2'
40-
- '3.3'
41-
- '3.4'
42-
- '3.5'
43-
- '3.6'
44-
- '3.7'
45-
- '3.8'
46-
- '3.9'
59+
kong_version: ${{ fromJSON(needs.supported-kong-versions.outputs.result) }}
4760
env:
4861
KONG_ROUTER_FLAVOR: ${{ matrix.router_flavor }}
4962
KONG_IMAGE_TAG: ${{ matrix.kong_version }}

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@ golangci-lint: mise yq ## Download golangci-lint locally if necessary.
3030
@$(MISE) plugin install --yes -q golangci-lint
3131
@$(MISE) install -q golangci-lint@$(GOLANGCI_LINT_VERSION)
3232

33+
# ------------------------------------------------------------------------------
34+
# CI
35+
# ------------------------------------------------------------------------------
36+
37+
38+
.PHONY: kong.supported-versions
39+
kong.supported-versions:
40+
@curl -s https://docs.konghq.com/_api/gateway-versions.json | \
41+
jq '[.[] | select(.label == null) | select(.endOfLifeDate > (now | strftime("%Y-%m-%d")))] | [.[].tag]'
42+
3343
# ------------------------------------------------------------------------------
3444
# Testing
3545
# ------------------------------------------------------------------------------

0 commit comments

Comments
 (0)