internal/envoy: support AuthPolicy on direct response routes (#6426) #10162
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: Build and Test Pull Request | |
# Trigger the workflow on push or pull request | |
on: | |
push: | |
branches-ignore: | |
- "dependabot/**" | |
pull_request: | |
types: [opened, synchronize] | |
permissions: | |
contents: read | |
env: | |
GOPROXY: https://proxy.golang.org/ | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
GO_VERSION: 1.22.2 | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
cache: false | |
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | |
with: | |
persist-credentials: false | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@23faadfdeb23a6f9e511beaba149bb123b5b145a # v6.0.0 | |
with: | |
version: v1.56.2 | |
args: --build-tags=e2e,conformance,tools,gcp,oidc,none --out-format=colored-line-number | |
- uses: act10ns/slack@44541246747a30eb3102d87f7a4cc5471b0ffb7d # v2.1.0 | |
with: | |
status: ${{ job.status }} | |
steps: ${{ toJson(steps) }} | |
channel: '#contour-ci-notifications' | |
if: ${{ failure() && github.ref == 'refs/heads/main' }} | |
codespell: | |
name: Codespell | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | |
with: | |
persist-credentials: false | |
- name: Codespell | |
uses: codespell-project/actions-codespell@94259cd8be02ad2903ba34a22d9c13de21a74461 # v2.0 | |
with: | |
skip: .git,*.png,*.woff,*.woff2,*.eot,*.ttf,*.jpg,*.ico,*.svg,./site/themes/contour/static/fonts/README.md,./vendor,./site/public,./hack/actions/check-changefile-exists.go,go.mod,go.sum | |
ignore_words_file: './.codespell.ignorewords' | |
check_filenames: true | |
check_hidden: true | |
- uses: act10ns/slack@44541246747a30eb3102d87f7a4cc5471b0ffb7d # v2.1.0 | |
with: | |
status: ${{ job.status }} | |
steps: ${{ toJson(steps) }} | |
channel: '#contour-ci-notifications' | |
if: ${{ failure() && github.ref == 'refs/heads/main' }} | |
codegen: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | |
with: | |
persist-credentials: false | |
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | |
with: | |
# * Module download cache | |
# * Build cache (Linux) | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
key: ${{ runner.os }}-${{ github.job }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-${{ github.job }}-go- | |
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
cache: false | |
- name: add deps to path | |
run: | | |
./hack/actions/install-kubernetes-toolchain.sh $GITHUB_WORKSPACE/bin | |
echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH | |
- name: generate | |
run: | | |
make generate lint-yamllint lint-flags | |
./hack/actions/check-uncommitted-codegen.sh | |
- uses: act10ns/slack@44541246747a30eb3102d87f7a4cc5471b0ffb7d # v2.1.0 | |
with: | |
status: ${{ job.status }} | |
steps: ${{ toJson(steps) }} | |
channel: '#contour-ci-notifications' | |
if: ${{ failure() && github.ref == 'refs/heads/main' }} | |
build-image: | |
needs: | |
- lint | |
- codespell | |
- codegen | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | |
with: | |
persist-credentials: false | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0 | |
with: | |
version: latest | |
- name: Build image | |
env: | |
TAG_LATEST: "false" | |
run: | | |
make multiarch-build | |
- name: Upload image | |
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 | |
with: | |
name: image | |
path: image/contour-*.tar | |
- uses: act10ns/slack@44541246747a30eb3102d87f7a4cc5471b0ffb7d # v2.1.0 | |
with: | |
status: ${{ job.status }} | |
steps: ${{ toJson(steps) }} | |
channel: '#contour-ci-notifications' | |
if: ${{ failure() && github.ref == 'refs/heads/main' }} | |
e2e: | |
runs-on: ubuntu-latest | |
needs: [build-image] | |
strategy: | |
matrix: | |
# use stable kubernetes_version values since they're included | |
# in the name of the GitHub Actions job, and we don't want to | |
# have to update branch protection rules every time we change | |
# a Kubernetes version number. | |
kubernetes_version: ["kubernetes:latest", "kubernetes:n-1", "kubernetes:n-2"] | |
# run tests using the configuration crd as well as without | |
config_type: ["ConfigmapConfiguration", "ContourConfiguration"] | |
# include defines an additional variable (the specific node | |
# image to use) for each kubernetes_version value. | |
include: | |
- kubernetes_version: "kubernetes:latest" | |
node_image: "docker.io/kindest/node:v1.29.2@sha256:51a1434a5397193442f0be2a297b488b6c919ce8a3931be0ce822606ea5ca245" | |
- kubernetes_version: "kubernetes:n-1" | |
node_image: "docker.io/kindest/node:v1.28.7@sha256:9bc6c451a289cf96ad0bbaf33d416901de6fd632415b076ab05f5fa7e4f65c58" | |
- kubernetes_version: "kubernetes:n-2" | |
node_image: "docker.io/kindest/node:v1.27.11@sha256:681253009e68069b8e01aad36a1e0fa8cf18bb0ab3e5c4069b2e65cafdd70843" | |
- config_type: "ConfigmapConfiguration" | |
use_config_crd: "false" | |
- config_type: "ContourConfiguration" | |
use_config_crd: "true" | |
steps: | |
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | |
with: | |
persist-credentials: false | |
- name: Download image | |
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 | |
with: | |
name: image | |
path: image | |
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | |
with: | |
# * Module download cache | |
# * Build cache (Linux) | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
key: ${{ runner.os }}-${{ github.job }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-${{ github.job }}-go- | |
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
cache: false | |
- name: add deps to path | |
run: | | |
./hack/actions/install-kubernetes-toolchain.sh $GITHUB_WORKSPACE/bin | |
echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH | |
- name: e2e tests | |
env: | |
NODEIMAGE: ${{ matrix.node_image }} | |
LOAD_PREBUILT_IMAGE: "true" | |
USE_CONTOUR_CONFIGURATION_CRD: ${{ matrix.use_config_crd }} | |
run: | | |
export CONTOUR_E2E_IMAGE="ghcr.io/projectcontour/contour:$(ls ./image/contour-*.tar | sed -E 's/.*contour-(.*).tar/\1/')" | |
make e2e | |
- uses: act10ns/slack@44541246747a30eb3102d87f7a4cc5471b0ffb7d # v2.1.0 | |
with: | |
status: ${{ job.status }} | |
steps: ${{ toJson(steps) }} | |
channel: '#contour-ci-notifications' | |
if: ${{ failure() && github.ref == 'refs/heads/main' }} | |
upgrade: | |
runs-on: ubuntu-latest | |
needs: [build-image] | |
strategy: | |
matrix: | |
# use stable kubernetes_version values since they're included | |
# in the name of the GitHub Actions job, and we don't want to | |
# have to update branch protection rules every time we change | |
# a Kubernetes version number. | |
kubernetes_version: ["kubernetes:latest", "kubernetes:n-1", "kubernetes:n-2"] | |
# include defines an additional variable (the specific node | |
# image to use) for each kubernetes_version value. | |
include: | |
- kubernetes_version: "kubernetes:latest" | |
node_image: "docker.io/kindest/node:v1.29.2@sha256:51a1434a5397193442f0be2a297b488b6c919ce8a3931be0ce822606ea5ca245" | |
- kubernetes_version: "kubernetes:n-1" | |
node_image: "docker.io/kindest/node:v1.28.7@sha256:9bc6c451a289cf96ad0bbaf33d416901de6fd632415b076ab05f5fa7e4f65c58" | |
- kubernetes_version: "kubernetes:n-2" | |
node_image: "docker.io/kindest/node:v1.27.11@sha256:681253009e68069b8e01aad36a1e0fa8cf18bb0ab3e5c4069b2e65cafdd70843" | |
steps: | |
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | |
with: | |
persist-credentials: false | |
# Fetch history for all tags and branches so we can figure out most | |
# recent release tag. | |
fetch-depth: 0 | |
- name: Download image | |
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 | |
with: | |
name: image | |
path: image | |
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | |
with: | |
# * Module download cache | |
# * Build cache (Linux) | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
key: ${{ runner.os }}-${{ github.job }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-${{ github.job }}-go- | |
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
cache: false | |
- name: add deps to path | |
run: | | |
./hack/actions/install-kubernetes-toolchain.sh $GITHUB_WORKSPACE/bin | |
echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH | |
- name: upgrade tests | |
env: | |
NODEIMAGE: ${{ matrix.node_image }} | |
MULTINODE_CLUSTER: "true" | |
LOAD_PREBUILT_IMAGE: "true" | |
SKIP_GATEWAY_API_INSTALL: "true" | |
run: | | |
export CONTOUR_E2E_IMAGE="ghcr.io/projectcontour/contour:$(ls ./image/contour-*.tar | sed -E 's/.*contour-(.*).tar/\1/')" | |
make upgrade | |
- uses: act10ns/slack@44541246747a30eb3102d87f7a4cc5471b0ffb7d # v2.1.0 | |
with: | |
status: ${{ job.status }} | |
steps: ${{ toJson(steps) }} | |
channel: '#contour-ci-notifications' | |
if: ${{ failure() && github.ref == 'refs/heads/main' }} | |
test-linux: | |
needs: | |
- lint | |
- codespell | |
- codegen | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | |
with: | |
persist-credentials: false | |
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | |
with: | |
# * Module download cache | |
# * Build cache (Linux) | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
key: ${{ runner.os }}-${{ github.job }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-${{ github.job }}-go- | |
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
cache: false | |
- name: add deps to path | |
run: | | |
./hack/actions/install-kubernetes-toolchain.sh $GITHUB_WORKSPACE/bin | |
echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH | |
- name: test | |
env: | |
# TODO: remove once https://github.com/golang/go/issues/65653 is fixed | |
GOEXPERIMENT: nocoverageredesign | |
run: | | |
make install | |
make check-coverage | |
- name: codeCoverage | |
if: ${{ success() }} | |
uses: codecov/codecov-action@5ecb98a3c6b747ed38dc09f787459979aebb39be # v4.3.1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: coverage.out | |
- uses: act10ns/slack@44541246747a30eb3102d87f7a4cc5471b0ffb7d # v2.1.0 | |
with: | |
status: ${{ job.status }} | |
steps: ${{ toJson(steps) }} | |
channel: '#contour-ci-notifications' | |
if: ${{ failure() && github.ref == 'refs/heads/main' }} | |
test-osx: | |
needs: | |
- lint | |
- codespell | |
- codegen | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | |
with: | |
persist-credentials: false | |
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | |
with: | |
# * Module download cache | |
# * Build cache (Windows) | |
path: | | |
~/go/pkg/mod | |
~/Library/Caches/go-build | |
key: ${{ runner.os }}-${{ github.job }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-${{ github.job }}-go- | |
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
cache: false | |
- name: add deps to path | |
run: | | |
./hack/actions/install-kubernetes-toolchain.sh $GITHUB_WORKSPACE/bin | |
echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH | |
- name: test | |
env: | |
# TODO: remove once https://github.com/golang/go/issues/65653 is fixed | |
GOEXPERIMENT: nocoverageredesign | |
run: | | |
make install | |
make check-coverage | |
- uses: act10ns/slack@44541246747a30eb3102d87f7a4cc5471b0ffb7d # v2.1.0 | |
with: | |
status: ${{ job.status }} | |
steps: ${{ toJson(steps) }} | |
channel: '#contour-ci-notifications' | |
if: ${{ failure() && github.ref == 'refs/heads/main' }} | |
gateway-conformance: | |
runs-on: ubuntu-latest | |
needs: [build-image] | |
steps: | |
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | |
with: | |
persist-credentials: false | |
- name: Download image | |
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 | |
with: | |
name: image | |
path: image | |
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | |
with: | |
# * Module download cache | |
# * Build cache (Linux) | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
key: ${{ runner.os }}-${{ github.job }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-${{ github.job }}-go- | |
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
cache: false | |
- name: add deps to path | |
run: | | |
./hack/actions/install-kubernetes-toolchain.sh $GITHUB_WORKSPACE/bin | |
echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH | |
- name: Gateway API conformance tests | |
env: | |
LOAD_PREBUILT_IMAGE: "true" | |
run: | | |
export CONTOUR_E2E_IMAGE="ghcr.io/projectcontour/contour:$(ls ./image/contour-*.tar | sed -E 's/.*contour-(.*).tar/\1/')" | |
make gateway-conformance | |
- uses: act10ns/slack@44541246747a30eb3102d87f7a4cc5471b0ffb7d # v2.1.0 | |
with: | |
status: ${{ job.status }} | |
steps: ${{ toJson(steps) }} | |
channel: '#contour-ci-notifications' | |
if: ${{ failure() && github.ref == 'refs/heads/main' }} |