Skip to content

lint fixes

lint fixes #2192

Workflow file for this run

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.4
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: ${{ env.GO_VERSION }}
cache: false
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
persist-credentials: false
- name: golangci-lint
uses: golangci/golangci-lint-action@a4f60bb28d35aeee14e6880718e0c85ff1882e64 # v6.0.1
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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
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@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
persist-credentials: false
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4fd812986e6c8c2a69e18311145f9371337f27d4 # v3.4.0
with:
version: latest
- name: Build image
env:
TAG_LATEST: "false"
run: |
make multiarch-build
- name: Upload image
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
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.30.0@sha256:047357ac0cfea04663786a612ba1eaba9702bef25227a794b52890dd8bcd692e"
- kubernetes_version: "kubernetes:n-1"
node_image: "docker.io/kindest/node:v1.29.4@sha256:3abb816a5b1061fb15c6e9e60856ec40d56b7b52bcea5f5f1350bc6e2320b6f8"
- kubernetes_version: "kubernetes:n-2"
node_image: "docker.io/kindest/node:v1.28.9@sha256:dca54bc6a6079dd34699d53d7d4ffa2e853e46a20cd12d619a09207e35300bd0"
- config_type: "ConfigmapConfiguration"
use_config_crd: "false"
- config_type: "ContourConfiguration"
use_config_crd: "true"
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
persist-credentials: false
- name: Download image
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
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@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
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.30.0@sha256:047357ac0cfea04663786a612ba1eaba9702bef25227a794b52890dd8bcd692e"
- kubernetes_version: "kubernetes:n-1"
node_image: "docker.io/kindest/node:v1.29.4@sha256:3abb816a5b1061fb15c6e9e60856ec40d56b7b52bcea5f5f1350bc6e2320b6f8"
- kubernetes_version: "kubernetes:n-2"
node_image: "docker.io/kindest/node:v1.28.9@sha256:dca54bc6a6079dd34699d53d7d4ffa2e853e46a20cd12d619a09207e35300bd0"
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
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@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
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@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
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@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
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@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
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@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
persist-credentials: false
- name: Download image
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
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@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
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' }}