Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
ci: wire golangci-lint + gosec into CI (advisory); migrate config to v2#423
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
9a0cdd7
ci: migrate .golangci.yml to v2 format and enable gosec
LukasWodka 190c6c3
ci: run golangci-lint + gosec in CI (advisory, not required)
LukasWodka 376977f
ci: advisory mode via --issues-exit-code=0, not continue-on-error
LukasWodka ea7832d
ci: document the typecheck blind spot of advisory mode accurately
LukasWodka File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| name: golangci-lint | ||
| # Runs golangci-lint (with the gosec security linter) against the | ||
| # repo's .golangci.yml on every PR + push to develop/main. This is the | ||
| # "one tool, one config" successor being sized up for the standalone | ||
| # lint steps in build.yml, and the first thing in this repo that scans | ||
| # our own code for insecure patterns — govulncheck (build.yml + | ||
| # vulncheck.yml) only covers known CVEs in dependencies. | ||
| # | ||
| # Why the action is safe now: the golangci-lint-action timeout story | ||
| # (#6) was the SSA linters (staticcheck, unused) choking on the | ||
| # k8s.io/* dep tree. The current .golangci.yml enables no SSA linters; | ||
| # a full run measures ~11s wall locally / ~62s on the runner (#423). | ||
| # | ||
| # Part of backend#1305 (epic #930, Layer 1). | ||
| on: | ||
| push: | ||
| branches: [develop, main] | ||
| pull_request: | ||
| branches: [develop, main] | ||
| permissions: | ||
| contents: read | ||
| concurrency: | ||
| group: golangci-${{ github.ref }} | ||
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | ||
| jobs: | ||
| golangci: | ||
| timeout-minutes: 10 | ||
| name: golangci-lint (advisory) | ||
| runs-on: ubuntu-latest | ||
| # ============================ ADVISORY ============================ | ||
| # DELIBERATELY not a required check, and `--issues-exit-code=0` on | ||
| # the run step keeps findings from red-Xing the job: golangci-lint | ||
| # exits non-zero on any finding by default, and the pre-existing | ||
| # gosec backlog (8 findings at introduction: 4x G204, 3x G304, | ||
| # 1x G115 — sized on #423, the PR that added this job) would | ||
| # otherwise fail every PR for issues it didn't introduce. Findings | ||
| # still surface as inline annotations and in the job log. | ||
| # | ||
| # Known blind spot while advisory: typecheck (compile) errors ride | ||
| # the same issues exit path as lint findings, so under this flag | ||
| # they exit 0 too (verified empirically on #423 — this is NOT a | ||
| # separate exit code). No real signal is lost: a non-compiling PR | ||
| # reds the required Test / Lint / Build jobs anyway, and a broken | ||
| # .golangci.yml still fails THIS job via the action's | ||
| # `golangci-lint config verify` pre-step, which --issues-exit-code | ||
| # does not touch. | ||
| # | ||
| # (Job-level `continue-on-error: true` is NOT the tool for this — | ||
| # it greens the workflow run but still shows the job itself as | ||
| # failed in the PR checks list; see the first run on #423.) | ||
| # | ||
| # REMOVE the `--issues-exit-code=0` arg when the backlog hits zero | ||
| # and this check flips to required (the advisory -> required | ||
| # pattern from backend#1303; tracked under backend#1305 / epic | ||
| # #930). A required check that can't fail is worse than no check. | ||
| # ================================================================== | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| - name: Set up Go | ||
| uses: actions/setup-go@v7 | ||
| with: | ||
| go-version-file: go.mod | ||
| cache: true | ||
| # Both versions pinned for reproducibility, same policy as the | ||
| # standalone tools in build.yml (#127). golangci-lint v2.12.2 is | ||
| # built with Go 1.26 (required: go.mod says `go 1.26.0`; v1-era | ||
| # binaries can't typecheck this module). Bump deliberately, and | ||
| # keep the version in step with the format expectations noted in | ||
| # .golangci.yml. | ||
| - name: golangci-lint run (.golangci.yml) | ||
| uses: golangci/golangci-lint-action@v9.3.0 | ||
| with: | ||
| version: v2.12.2 | ||
| # ADVISORY MODE — see the block comment above (incl. the | ||
| # typecheck caveat). Remove at the required-flip. | ||
| args: --issues-exit-code=0 | ||
This file contains hidden or 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
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.