From 0620f7992013bf044298bae47936a54d7fc8e496 Mon Sep 17 00:00:00 2001 From: Michael Gasch <15986659+embano1@users.noreply.github.com> Date: Sat, 1 Jul 2023 08:00:39 +0200 Subject: [PATCH 1/2] fix: workflows Update goreleaser configuration Reorder checkout steps to make correct use of caching Signed-off-by: Michael Gasch <15986659+embano1@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/gcr-dev-image.yml | 5 +++-- .github/workflows/gcr-prerelease-image.yml | 5 +++-- .github/workflows/release.yml | 8 +++++--- .github/workflows/router-build.yml | 18 ++++++++++-------- .github/workflows/router-helm.yml | 16 ++++++---------- .github/workflows/router-integration-tests.yml | 6 +++--- .github/workflows/router-lint.yml | 5 +++-- .github/workflows/router-unit-tests.yml | 7 ++++--- vmware-event-router/.goreleaser.yaml | 5 ----- 10 files changed, 39 insertions(+), 40 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 1ca7b806..112a6508 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -13,10 +13,10 @@ name: "CodeQL" on: push: - branches: [main] + branches: [main,master] pull_request: # The branches below must be a subset of the branches above - branches: [main] + branches: [main,master] schedule: - cron: "34 21 * * 5" diff --git a/.github/workflows/gcr-dev-image.yml b/.github/workflows/gcr-dev-image.yml index 0cde4210..d9de5fbe 100644 --- a/.github/workflows/gcr-dev-image.yml +++ b/.github/workflows/gcr-dev-image.yml @@ -29,6 +29,8 @@ jobs: PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }} steps: + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 + - name: Setup ko uses: imjasonh/setup-ko@ace48d793556083a76f1e3e6068850c1f4a369aa # v0.6 @@ -36,10 +38,9 @@ jobs: uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 with: go-version: ${{ matrix.go-version }} + cache-dependency-path: vmware-event-router/go.sum id: go - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 - - id: login_to_gcp uses: google-github-actions/auth@35b0e87d162680511bf346c299f71c9c5c379033 with: diff --git a/.github/workflows/gcr-prerelease-image.yml b/.github/workflows/gcr-prerelease-image.yml index 8f05f41f..d4bb0c72 100644 --- a/.github/workflows/gcr-prerelease-image.yml +++ b/.github/workflows/gcr-prerelease-image.yml @@ -24,6 +24,8 @@ jobs: PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }} steps: + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 + - name: Setup ko uses: imjasonh/setup-ko@ace48d793556083a76f1e3e6068850c1f4a369aa # v0.6 @@ -31,10 +33,9 @@ jobs: uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 with: go-version: ${{ matrix.go-version }} + cache-dependency-path: vmware-event-router/go.sum id: go - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 - - id: login_to_gcp uses: google-github-actions/auth@35b0e87d162680511bf346c299f71c9c5c379033 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d5c755d0..8fdc2b46 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,6 +32,7 @@ jobs: uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 with: go-version: ${{ matrix.go-version }} + cache-dependency-path: vmware-event-router/go.sum - name: Create CHANGELOG for Release env: @@ -46,7 +47,7 @@ jobs: - name: GoReleaser uses: goreleaser/goreleaser-action@336e29918d653399e599bfca99fadc1d7ffbc9f7 with: - args: release --rm-dist --release-notes RELEASE_CHANGELOG.md + args: release --clean --release-notes RELEASE_CHANGELOG.md workdir: vmware-event-router env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -111,6 +112,8 @@ jobs: runs-on: ${{ matrix.platform }} steps: + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 + - name: Setup ko uses: imjasonh/setup-ko@ace48d793556083a76f1e3e6068850c1f4a369aa # v0.6 @@ -118,10 +121,9 @@ jobs: uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 with: go-version: ${{ matrix.go-version }} + cache-dependency-path: vmware-event-router/go.sum id: go - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 - - id: login_to_gcp uses: google-github-actions/auth@35b0e87d162680511bf346c299f71c9c5c379033 with: diff --git a/.github/workflows/router-build.yml b/.github/workflows/router-build.yml index 27ec3fd5..647ca3cf 100644 --- a/.github/workflows/router-build.yml +++ b/.github/workflows/router-build.yml @@ -29,20 +29,21 @@ jobs: timeout-minutes: 20 steps: + - name: Check out code + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 + - name: Set up Go ${{ matrix.go-version }} uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 with: go-version: ${{ matrix.go-version }} + cache-dependency-path: vmware-event-router/go.sum id: go - - name: Check out code - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 - - name: GoReleaser Snapshot uses: goreleaser/goreleaser-action@336e29918d653399e599bfca99fadc1d7ffbc9f7 with: version: latest - args: release --rm-dist --snapshot + args: release --clean --snapshot workdir: vmware-event-router env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -52,7 +53,7 @@ jobs: with: name: dist path: | - vmware-event-router/dist/router_Linux_*.tar.gz + vmware-event-router/dist/router_linux_*.tar.gz vmware-event-router/dist/checksums.txt retention-days: 1 @@ -69,6 +70,9 @@ jobs: KO_DOCKER_REPO: us.gcr.io/daisy-284300/veba # .../router@sha256: steps: + - name: Check out code + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 + - name: Setup ko uses: imjasonh/setup-ko@ace48d793556083a76f1e3e6068850c1f4a369aa # v0.6 @@ -76,11 +80,9 @@ jobs: uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 with: go-version: ${{ matrix.go-version }} + cache-dependency-path: vmware-event-router/go.sum id: go - - name: Check out code - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 - - name: Get short COMMIT and TAG run: | echo "KO_COMMIT=$(echo -n $GITHUB_SHA | cut -c -8)" >> $GITHUB_ENV diff --git a/.github/workflows/router-helm.yml b/.github/workflows/router-helm.yml index a187bef7..3c4f808f 100644 --- a/.github/workflows/router-helm.yml +++ b/.github/workflows/router-helm.yml @@ -23,19 +23,17 @@ jobs: timeout-minutes: 15 steps: + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 + - name: Set up Go uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 with: go-version: 1.19 + cache-dependency-path: vmware-event-router/go.sum - name: Setup ko uses: imjasonh/setup-ko@ace48d793556083a76f1e3e6068850c1f4a369aa # v0.6 - - name: Check out code onto GOPATH - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 - with: - fetch-depth: 1 - - name: Get short COMMIT and TAG (used by ko) run: | echo "KO_COMMIT=$(echo -n $GITHUB_SHA | cut -c -8)" >> $GITHUB_ENV @@ -135,19 +133,17 @@ jobs: timeout-minutes: 15 steps: + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 + - name: Set up Go uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 with: go-version: 1.19 + cache-dependency-path: vmware-event-router/go.sum - name: Setup ko uses: imjasonh/setup-ko@ace48d793556083a76f1e3e6068850c1f4a369aa # v0.6 - - name: Check out code onto GOPATH - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 - with: - fetch-depth: 1 - - name: Get short COMMIT and TAG (used by ko) run: | echo "KO_COMMIT=$(echo -n $GITHUB_SHA | cut -c -8)" >> $GITHUB_ENV diff --git a/.github/workflows/router-integration-tests.yml b/.github/workflows/router-integration-tests.yml index 0de601e0..8ce1f544 100644 --- a/.github/workflows/router-integration-tests.yml +++ b/.github/workflows/router-integration-tests.yml @@ -28,15 +28,15 @@ jobs: timeout-minutes: 20 steps: + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 + - name: Set up Go ${{ matrix.go-version }} uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 with: go-version: ${{ matrix.go-version }} + cache-dependency-path: vmware-event-router/go.sum id: go - - name: Check out code - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 - - name: Install tparse run: go install github.com/mfridman/tparse@latest diff --git a/.github/workflows/router-lint.yml b/.github/workflows/router-lint.yml index 3ddc327f..a5f0df6f 100644 --- a/.github/workflows/router-lint.yml +++ b/.github/workflows/router-lint.yml @@ -23,14 +23,15 @@ jobs: timeout-minutes: 20 steps: + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 + - name: Set up Go ${{ matrix.go-version }} uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 with: go-version: ${{ matrix.go-version }} + cache: false # use golangci-lint caching id: go - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 - - name: golangci-lint uses: golangci/golangci-lint-action@639cd343e1d3b897ff35927a75193d57cfcba299 with: diff --git a/.github/workflows/router-unit-tests.yml b/.github/workflows/router-unit-tests.yml index add42693..598ce062 100644 --- a/.github/workflows/router-unit-tests.yml +++ b/.github/workflows/router-unit-tests.yml @@ -29,15 +29,16 @@ jobs: timeout-minutes: 10 steps: + - name: Check out code + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 + - name: Set up Go ${{ matrix.go-version }} uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 with: go-version: ${{ matrix.go-version }} + cache-dependency-path: vmware-event-router/go.sum id: go - - name: Check out code - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 - - name: Install tparse run: go install github.com/mfridman/tparse@latest diff --git a/vmware-event-router/.goreleaser.yaml b/vmware-event-router/.goreleaser.yaml index 6cda140a..281f4872 100644 --- a/vmware-event-router/.goreleaser.yaml +++ b/vmware-event-router/.goreleaser.yaml @@ -20,11 +20,6 @@ archives: builds: - router name_template: "router_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}" - replacements: &replacements - darwin: Darwin - linux: Linux - windows: Windows - amd64: x86_64 format_overrides: - goos: windows format: zip From cb0ddcdaced769605cfc349b0d58d8f4cd2ff86e Mon Sep 17 00:00:00 2001 From: Michael Gasch <15986659+embano1@users.noreply.github.com> Date: Sat, 1 Jul 2023 08:18:17 +0200 Subject: [PATCH 2/2] ci: disable depguard linter Signed-off-by: Michael Gasch <15986659+embano1@users.noreply.github.com> --- vmware-event-router/.golangci.yml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/vmware-event-router/.golangci.yml b/vmware-event-router/.golangci.yml index a0fa4809..50b320e5 100644 --- a/vmware-event-router/.golangci.yml +++ b/vmware-event-router/.golangci.yml @@ -1,12 +1,4 @@ linters-settings: - depguard: - list-type: blacklist - packages: - # logging is allowed only by logutils.Log, logrus - # is allowed to use only in logutils package - - github.com/sirupsen/logrus - packages-with-error-message: - - github.com/sirupsen/logrus: "logging is allowed only by logutils.Log" dupl: threshold: 100 funlen: @@ -65,7 +57,7 @@ linters: enable: - bodyclose # - deadcode - - depguard + # - depguard - dogsled - dupl - errcheck