From a5641c05d1a327107cbb0ed83c9dc7f5a8f02a57 Mon Sep 17 00:00:00 2001 From: Parship Chowdhury Date: Wed, 21 Jan 2026 17:51:06 +0000 Subject: [PATCH 1/2] fix make lint/go for non-interactive environments and simplify CI Signed-off-by: Parship Chowdhury --- .github/workflows/lint.yaml | 45 ++++--------------------------------- Makefile | 2 +- 2 files changed, 5 insertions(+), 42 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index f3e1130763..1ff70f9ba6 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -20,51 +20,14 @@ env: HELM_VERSION: 3.17.3 jobs: - list-go-modules: - runs-on: ubuntu-24.04 - outputs: - modules: ${{ steps.list-go-modules.outputs.modules }} - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: List go modules - id: list-go-modules - run: | - echo "modules=$(find . -name go.mod -exec dirname {} \; | sort | jq -R -s -c 'split("\n") | map(select(length > 0))')" >> $GITHUB_OUTPUT - go: runs-on: ubuntu-24.04 - needs: list-go-modules - strategy: - fail-fast: false - matrix: - module: ${{ fromJSON(needs.list-go-modules.outputs.modules) }} steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: golangci-lint - uses: reviewdog/action-golangci-lint@f9bba13753278f6a73b27a56a3ffb1bfda90ed71 #v2.8.0 - with: - workdir: ${{ matrix.module }} - go_version: ${{ env.GO_VERSION }} - golangci_lint_version: ${{ env.GOLANGCI_LINT_VERSION }} - golangci_lint_flags: --config ${{ github.workspace }}/.golangci.yml - fail_level: error - - # This job is used to check if the go linting is completed successfully - # It is used to set as required check for the branch protection rules - go-lint-completed: - runs-on: ubuntu-24.04 - if: always() - needs: go - steps: - - name: Check if all go lint jobs succeeded - # if jobs in the 'go' job matrix failed or were cancelled, this job will fail - # otherwise this job is marked as successful because all steps are skipped - run: exit 1 - if: >- - ${{ - contains(needs.*.result, 'failure') - || contains(needs.*.result, 'cancelled') - }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Run Go linting with make + run: make lint/go web: runs-on: ubuntu-24.04 diff --git a/Makefile b/Makefile index c9267bc6cb..60f6141beb 100644 --- a/Makefile +++ b/Makefile @@ -213,7 +213,7 @@ lint: lint/go lint/web lint/helm .PHONY: lint/go lint/go: FIX ?= false lint/go: VERSION ?= sha256:91460846c43b3de53eb77e968b17363e8747e6f3fc190575b52be60c49446e23 # golangci/golangci-lint:v2.4.0 -lint/go: FLAGS ?= --rm -e GOCACHE=/repo/.cache/go-build -e GOLANGCI_LINT_CACHE=/repo/.cache/golangci-lint -v ${PWD}:/repo -it +lint/go: FLAGS ?= --rm -e GOCACHE=/repo/.cache/go-build -e GOLANGCI_LINT_CACHE=/repo/.cache/golangci-lint -v ${PWD}:/repo lint/go: MODULES ?= $(shell find . -name go.mod | while read -r dir; do dirname "$$dir"; done | paste -sd, -) # comma separated list of modules. eg: MODULES=.,pkg/plugin/sdk lint/go: @echo "Linting go modules..." From 5b45795b52a351327c643f044d0a1437448afd3f Mon Sep 17 00:00:00 2001 From: Parship Chowdhury Date: Sun, 25 Jan 2026 10:51:36 +0000 Subject: [PATCH 2/2] remove lint.yaml changes Signed-off-by: Parship Chowdhury --- .github/workflows/lint.yaml | 45 +++++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 1ff70f9ba6..f3e1130763 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -20,14 +20,51 @@ env: HELM_VERSION: 3.17.3 jobs: + list-go-modules: + runs-on: ubuntu-24.04 + outputs: + modules: ${{ steps.list-go-modules.outputs.modules }} + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: List go modules + id: list-go-modules + run: | + echo "modules=$(find . -name go.mod -exec dirname {} \; | sort | jq -R -s -c 'split("\n") | map(select(length > 0))')" >> $GITHUB_OUTPUT + go: runs-on: ubuntu-24.04 + needs: list-go-modules + strategy: + fail-fast: false + matrix: + module: ${{ fromJSON(needs.list-go-modules.outputs.modules) }} steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Run Go linting with make - run: make lint/go + - name: golangci-lint + uses: reviewdog/action-golangci-lint@f9bba13753278f6a73b27a56a3ffb1bfda90ed71 #v2.8.0 + with: + workdir: ${{ matrix.module }} + go_version: ${{ env.GO_VERSION }} + golangci_lint_version: ${{ env.GOLANGCI_LINT_VERSION }} + golangci_lint_flags: --config ${{ github.workspace }}/.golangci.yml + fail_level: error + + # This job is used to check if the go linting is completed successfully + # It is used to set as required check for the branch protection rules + go-lint-completed: + runs-on: ubuntu-24.04 + if: always() + needs: go + steps: + - name: Check if all go lint jobs succeeded + # if jobs in the 'go' job matrix failed or were cancelled, this job will fail + # otherwise this job is marked as successful because all steps are skipped + run: exit 1 + if: >- + ${{ + contains(needs.*.result, 'failure') + || contains(needs.*.result, 'cancelled') + }} web: runs-on: ubuntu-24.04