fix(build): use go tool mockgen and migrate goreleaser to v2#925
Conversation
Move all 15 bare mockgen invocations from the Makefile mock-gen target into //go:generate directives on each interface source file, using `go tool mockgen` so no separate binary install is needed. The mock-gen target is now redundant with `make generate` and is removed. Migrate .goreleaser.yaml to v2 format (version: 2, snapshot version_template) and update the Makefile to install goreleaser/v2 and use --clean instead of the deprecated --rm-dist. Assisted-by: Claude:claude-opus-4-6
WalkthroughThis pull request modernizes the project's build tooling and mock generation infrastructure. It upgrades GoReleaser from v1.14.1 to v2.15.3 with updated configuration syntax, migrates mock generation from a standalone installation to Go's tool dependency system (using Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@Makefile`:
- Line 78: The current Makefile check only ensures goreleaser exists but not its
version; update the rule that references goreleaser and GORELEASER_VERSION so it
verifies the installed goreleaser --version is at least v1.15.0 (or equals
GORELEASER_VERSION) and if not, install
github.com/goreleaser/goreleaser/v2@${GORELEASER_VERSION}; implement this by
invoking `goreleaser --version`, parsing the semver from its output and
comparing against the minimum required version (v1.15.0) or
${GORELEASER_VERSION}, and only skipping the go install when the installed
version satisfies the check.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: b02e45af-2975-4ec3-9ccb-e2c3db82e1b4
⛔ Files ignored due to path filters (1)
CLAUDE.mdis excluded by!**/*.md
📒 Files selected for processing (33)
.goreleaser.yamlMakefilecmd/ocm-backplane/cloud/ssm.gogo.modmake.Dockerfilepkg/backplaneapi/clientUtils.gopkg/backplaneapi/mocks/clientUtilsMock.gopkg/cli/config/api_client.gopkg/cli/session/mocks/sessionMock.gopkg/cli/session/session.gopkg/client/generate.gopkg/client/mocks/ClientMock.gopkg/client/mocks/ClientWithResponsesMock.gopkg/container/container.gopkg/container/mocks/containerEngineMock.gopkg/healthcheck/connectivity_checks.gopkg/healthcheck/mocks/httpClientMock.gopkg/healthcheck/mocks/networkMock.gopkg/info/buildInfo.gopkg/info/info.gopkg/info/mocks/buildInfoMock.gopkg/info/mocks/infoMock.gopkg/jira/issueService.gopkg/jira/mocks/jiraMock.gopkg/ocm/mocks/ocmWrapperMock.gopkg/ocm/ocm.gopkg/pagerduty/client.gopkg/pagerduty/mocks/clientMock.gopkg/ssm/mocks/mock_ssmclient.gopkg/utils/cluster.gopkg/utils/mocks/ClusterMock.gopkg/utils/mocks/shellCheckerMock.gopkg/utils/shell.go
💤 Files with no reviewable changes (1)
- make.Dockerfile
|
@cblecker: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #925 +/- ##
=======================================
Coverage 53.97% 53.97%
=======================================
Files 88 88
Lines 6662 6662
=======================================
Hits 3596 3596
Misses 2597 2597
Partials 469 469
🚀 New features to boost your workflow:
|
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cblecker, xiaoyu74 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Summary
mockgeninvocations from the Makefilemock-gentarget into//go:generatedirectives on each interface source file, usinggo tool mockgenso no separate binary install is needed. Remove the now-redundantmock-gentarget (covered bymake generate)..goreleaser.yamlto v2 format (version: 2,snapshot.version_template) and update the Makefile to installgoreleaser/v2and use--cleaninstead of the deprecated--rm-dist.go install mockgen@v1.6.0frommake.Dockerfile.Test plan
go mod tidysucceedsgo generate ./...succeeds (regenerates all mocks)make generatesucceedsmake testpassesgoreleaser build --snapshot --cleancompletes successfullySummary by CodeRabbit