CI: Updates Makefile and GH Workflow to Support Multiple Gateway API Versions #1392
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Regression Tests | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened, ready_for_review] | |
env: | |
VERSION: '1.0.0-ci1' | |
GITHUB_TOKEN: ${{ github.token }} # necessary to pass upgrade tests | |
jobs: | |
prepare_env: | |
name: Prepare Environment | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 5 | |
outputs: | |
should-auto-succeed-regression-tests: ${{ steps.run-strategy.outputs.auto_succeed }} | |
steps: | |
- name: Cancel Previous Actions | |
uses: styfle/cancel-workflow-action@0.12.1 | |
with: | |
access_token: ${{ github.token }} | |
- id: checkout-code | |
uses: actions/checkout@v4 | |
with: | |
# We require gathering the branch and tag history since we rely on a `git diff` | |
# which compares the state of two branches | |
fetch-depth: 0 | |
- id: process-skip-directives | |
uses: ./.github/workflows/composite-actions/process-skip-directives | |
with: | |
base-ref: ${{ github.base_ref }} | |
- id: run-strategy | |
name: Determine Test Run Strategy | |
run: | | |
skip_kube_tests=${{ steps.process-skip-directives.outputs.skip-kube-tests }} | |
if [[ ! -z $skip_kube_tests && $skip_kube_tests = true ]] ; then | |
echo "auto_succeed=true" >> $GITHUB_OUTPUT | |
fi | |
regression_tests: | |
name: k8s regression tests (${{matrix.kube-e2e-test-type}}) | |
needs: prepare_env | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 60 | |
if: ${{ !github.event.pull_request.draft }} | |
strategy: | |
fail-fast: false | |
matrix: | |
# upgrade tests are run on LTS but not on main branch, for main they are run nightly | |
# ingress will be deprecated from 1.17. Ref: https://solo-io-corp.slack.com/archives/G01EERAK3KJ/p1716389614777799 | |
# this is the github action version of ternary op | |
kube-e2e-test-type: [ 'gateway', 'gloo', 'upgrade' ] | |
kube-version: [ { node: 'v1.31.0@sha256:53df588e04085fd41ae12de0c3fe4c72f7013bba32a20e7325357a1ac94ba865', kubectl: 'v1.31.0', kind: 'v0.24.0', helm: 'v3.14.4' } ] | |
image-variant: | |
- distroless | |
merge-to-main: | |
- ${{ github.event.pull_request.base.ref == 'main' }} | |
exclude: | |
- merge-to-main: true | |
kube-e2e-test-type: upgrade | |
steps: | |
- uses: actions/checkout@v4 | |
- id: run-tests | |
if: needs.prepare_env.outputs.should-auto-succeed-regression-tests != 'true' | |
uses: ./.github/workflows/composite-actions/regression-tests | |
- id: auto-succeed-tests | |
if: needs.prepare_env.outputs.should-auto-succeed-regression-tests == 'true' | |
run: | | |
echo "Regression tests auto-succeeded" | |
kube_gateway_api_conformance_tests: | |
name: kubernetes gateway api conformance tests (${{matrix.image-variant}}) | |
needs: prepare_env | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 60 | |
if: ${{ !github.event.pull_request.draft }} | |
strategy: | |
fail-fast: false | |
matrix: | |
kube-version: [ { node: 'v1.31.0@sha256:53df588e04085fd41ae12de0c3fe4c72f7013bba32a20e7325357a1ac94ba865', kubectl: 'v1.31.0', kind: 'v0.24.0', helm: 'v3.14.4' } ] | |
# use standard since other variants don't currently work with these tests | |
# (see https://github.com/solo-io/solo-projects/issues/6094) | |
image-variant: | |
- standard | |
version-files: | |
- label: 'min' | |
file: './.github/workflows/.env/pr-tests/min_versions.env' | |
- label: 'max' | |
file: './.github/workflows/.env/pr-tests/max_versions.env' | |
steps: | |
# Checkout the branch that initiated the action | |
- uses: actions/checkout@v4 | |
- id: auto-succeed-tests | |
if: needs.prepare_env.outputs.should-auto-succeed-regression-tests == 'true' | |
run: | | |
echo "Kubernetes Gateway API conformance tests auto-succeeded" | |
# The dotenv action is used to load key-value pairs from files. | |
# In this case, the file is specified in the matrix and will contain the versions of the tools to use | |
- name: Dotenv Action | |
uses: falti/dotenv-action@v1.1.4 | |
id: dotenv | |
with: | |
path: ${{ matrix.version-files.file }} | |
log-variables: true | |
# Run the k8s gateway api conformance tests | |
- id: run-tests | |
if: needs.prepare_env.outputs.should-auto-succeed-regression-tests != 'true' | |
uses: ./.github/workflows/composite-actions/kube-gateway-api-conformance-tests | |
with: | |
k8sgateway-api-version: ${{ steps.dotenv.outputs.k8sgateway_api_version }} |