Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Update testing matrix + pre-release version #1756

Update testing matrix + pre-release version

Update testing matrix + pre-release version #1756

name: Conformance (Build)
on:
pull_request:
types: ["opened", "reopened", "synchronize", "labeled"]
push:
branches: ["conformance/*"]
workflow_dispatch:
inputs:
debug_enabled:
description: 'Start tmate session if any step fails'
required: false
type: boolean
default: false # GitHub parses this value to string, see https://github.com/actions/runner/issues/1483
debug_timeout_minutes:
description: 'How many minutes should the tmate session close itself after?'
required: false
type: string # No support for numeric value
default: '10'
env:
GO_VERSION: "1.19"
jobs:
run-on-kind:
# Run on PR only if there is a `pr/conformance` label
if: "github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'pr/conformance')"
runs-on: ubuntu-latest
strategy:
matrix:
config:
- name: "[email protected] + [email protected]"
api-gateway-image: "consul-api-gateway:local-build"
consul-image: "hashicorp/consul:1.14"
envoy-image: "envoyproxy/envoy:v1.24-latest"
consul-k8s-version: "v1.0.1"
envoy-field: "apiGateway.imageEnvoy"
- name: "[email protected] + [email protected]"
api-gateway-image: "consul-api-gateway:local-build"
consul-image: "hashicorp/consul:1.15"
envoy-image: "envoyproxy/envoy:v1.25-latest"
consul-k8s-version: "v1.1.2"
envoy-field: "apiGateway.imageEnvoy"
- name: "[email protected] + [email protected]"
api-gateway-image: "consul-api-gateway:local-build"
consul-image: "hashicorp/consul:1.16"
envoy-image: "envoyproxy/envoy:v1.26-latest"
consul-k8s-version: "v1.2.0"
envoy-field: "apiGateway.imageEnvoy"
fail-fast: false
name: "${{ matrix.config.name }}"
steps:
# Clone repos side-by-side:
# GITHUB_WORKSPACE/
# consul-api-gateway/
# consul-k8s/
# gateway-api/
- name: Checkout consul-api-gateway
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
path: "consul-api-gateway"
- name: Clone consul-k8s
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
repository: "hashicorp/consul-k8s"
ref: ${{ matrix.config.consul-k8s-version }}
path: "consul-k8s"
- name: Clone gateway-api
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
repository: "hashicorp/gateway-api"
ref: "conformance/v0.5.1-skipped-tests"
path: "gateway-api"
- name: Setup Goenv
uses: ./consul-api-gateway/.github/actions/goenv
with:
go-version: ${{ env.GO_VERSION }}
- name: Build binary
env:
CGO_ENABLED: "0"
GOARCH: "amd64"
GOOS: "linux"
working-directory: "consul-api-gateway"
run: go build -o ./consul-api-gateway
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4b4e9c3e2d4531116a6f8ba8e71fc6e2cb6e6c8c # v2.5.0
# docker build -f Dockerfile.local -t consul-api-gateway:local-build --platform linux/amd64 .
- name: Build Docker image
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 # v4.0.0
with:
context: "./consul-api-gateway"
platforms: "linux/amd64"
file: "./consul-api-gateway/Dockerfile.local"
load: true
push: false
tags: ${{ matrix.config.api-gateway-image }}
- name: Setup Kind cluster
uses: ./consul-api-gateway/.github/actions/setup-kind
with:
load-docker-image: ${{ matrix.config.api-gateway-image }}
metallb-config-path: "./consul-api-gateway/internal/testing/conformance/metallb-config.yaml"
- name: Install Consul API Gateway CRDs
working-directory: "consul-api-gateway"
run: kubectl apply --kustomize="./config/crd"
- name: Install Consul
working-directory: "consul-api-gateway/internal/testing/conformance"
run: |
helm install --values ./consul-config.yaml consul $GITHUB_WORKSPACE/consul-k8s/charts/consul --set global.image=${{ matrix.config.consul-image }} --set ${{ matrix.config.envoy-field }}=${{ matrix.config.envoy-image }} --set apiGateway.image=${{ matrix.config.api-gateway-image }} --create-namespace --namespace=consul
kubectl wait --for=condition=Ready --timeout=60s --namespace=consul pods --all
- name: Patch testing resources
working-directory: "consul-api-gateway/internal/testing/conformance"
run: |
cp kustomization.yaml proxydefaults.yaml $GITHUB_WORKSPACE/gateway-api/conformance/
cd $GITHUB_WORKSPACE/gateway-api/conformance/
kubectl kustomize ./ --output ./base/manifests.yaml
- name: Run tests
working-directory: "gateway-api/conformance"
run: go test -v -timeout 10m ./ --gateway-class=consul-api-gateway
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3 # TSCCR: no entry for repository "mxschmitt/action-tmate"
if: failure() && github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true'
timeout-minutes: ${{ fromJSON(github.event.inputs.debug_timeout_minutes) }}