Skip to content

fix(build): use go tool mockgen and migrate goreleaser to v2#925

Merged
openshift-merge-bot[bot] merged 1 commit intoopenshift:mainfrom
cblecker:fix/goreleaser-v2-mockgen-go-tool
Apr 16, 2026
Merged

fix(build): use go tool mockgen and migrate goreleaser to v2#925
openshift-merge-bot[bot] merged 1 commit intoopenshift:mainfrom
cblecker:fix/goreleaser-v2-mockgen-go-tool

Conversation

@cblecker
Copy link
Copy Markdown
Member

@cblecker cblecker commented Apr 15, 2026

Summary

  • 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. Remove the now-redundant mock-gen target (covered by make generate).
  • 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.
  • Remove go install mockgen@v1.6.0 from make.Dockerfile.

Test plan

  • go mod tidy succeeds
  • go generate ./... succeeds (regenerates all mocks)
  • make generate succeeds
  • make test passes
  • goreleaser build --snapshot --clean completes successfully

Summary by CodeRabbit

  • Chores
    • Upgraded GoReleaser from v1.14.1 to v2.15.3
    • Updated build configuration and release commands
    • Updated test infrastructure and SDK dependencies

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
@openshift-ci openshift-ci bot requested review from diakovnec and typeid April 15, 2026 15:05
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 15, 2026

Walkthrough

This 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 mockgen v0.4.0+ via go.mod), and updates generated mock files accordingly, including API client interface parameter type changes.

Changes

Cohort / File(s) Summary
Build & Tooling Infrastructure
.goreleaser.yaml, Makefile, make.Dockerfile, go.mod
Updated .goreleaser.yaml to version 2 syntax and renamed snapshot template field. Upgraded GoReleaser from v1.14.1 to v2.15.3, switched release command from --rm-dist to --clean, removed mock-gen target. Removed embedded mockgen installation from Dockerfile. Added go.uber.org/mock/mockgen as a Go tool dependency and moved ocm-api-model to indirect dependencies.
Mock Generation Directives
cmd/ocm-backplane/cloud/ssm.go, pkg/backplaneapi/clientUtils.go, pkg/cli/config/api_client.go, pkg/cli/session/session.go, pkg/container/container.go, pkg/healthcheck/connectivity_checks.go, pkg/info/buildInfo.go, pkg/info/info.go, pkg/jira/issueService.go, pkg/ocm/ocm.go, pkg/pagerduty/client.go, pkg/utils/cluster.go, pkg/utils/shell.go
Added //go:generate directives to invoke go tool mockgen for generating interface mocks. New file pkg/client/generate.go added with two generation directives for client interfaces.
Generated Mock Files - Path Updates
pkg/backplaneapi/mocks/clientUtilsMock.go, pkg/cli/session/mocks/sessionMock.go, pkg/client/mocks/ClientMock.go, pkg/client/mocks/ClientWithResponsesMock.go, pkg/container/mocks/containerEngineMock.go, pkg/healthcheck/mocks/httpClientMock.go, pkg/healthcheck/mocks/networkMock.go, pkg/info/mocks/buildInfoMock.go, pkg/info/mocks/infoMock.go, pkg/jira/mocks/jiraMock.go, pkg/pagerduty/mocks/clientMock.go, pkg/ssm/mocks/mock_ssmclient.go, pkg/utils/mocks/ClusterMock.go, pkg/utils/mocks/shellCheckerMock.go
Updated mockgen destination path comments in generated files from absolute paths (e.g., ./pkg/.../...) to relative paths (e.g., mocks/...).
API Client Mock Type Changes
pkg/client/mocks/ClientMock.go, pkg/client/mocks/ClientWithResponsesMock.go
Updated mock method signatures: CreateJob body parameter changed from Openapi.CreateJob to Openapi.CreateJobJSONRequestBody; CreateReport from Openapi.CreateReport to Openapi.CreateReportJSONRequestBody; CreateTestScriptRun from Openapi.CreateTestJob to Openapi.CreateTestScriptRunJSONRequestBody.
OCM Mock Import Updates
pkg/ocm/mocks/ocmWrapperMock.go
Updated imports to switch from github.com/openshift-online/ocm-api-model/... packages to equivalent github.com/openshift-online/ocm-sdk-go/... packages for accesstransparency and clustersmgmt modules.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: migrating to goreleaser v2 and switching to go tool mockgen for mock generation.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 849d479 and 0c1ae6e.

⛔ Files ignored due to path filters (1)
  • CLAUDE.md is excluded by !**/*.md
📒 Files selected for processing (33)
  • .goreleaser.yaml
  • Makefile
  • cmd/ocm-backplane/cloud/ssm.go
  • go.mod
  • make.Dockerfile
  • pkg/backplaneapi/clientUtils.go
  • pkg/backplaneapi/mocks/clientUtilsMock.go
  • pkg/cli/config/api_client.go
  • pkg/cli/session/mocks/sessionMock.go
  • pkg/cli/session/session.go
  • pkg/client/generate.go
  • pkg/client/mocks/ClientMock.go
  • pkg/client/mocks/ClientWithResponsesMock.go
  • pkg/container/container.go
  • pkg/container/mocks/containerEngineMock.go
  • pkg/healthcheck/connectivity_checks.go
  • pkg/healthcheck/mocks/httpClientMock.go
  • pkg/healthcheck/mocks/networkMock.go
  • pkg/info/buildInfo.go
  • pkg/info/info.go
  • pkg/info/mocks/buildInfoMock.go
  • pkg/info/mocks/infoMock.go
  • pkg/jira/issueService.go
  • pkg/jira/mocks/jiraMock.go
  • pkg/ocm/mocks/ocmWrapperMock.go
  • pkg/ocm/ocm.go
  • pkg/pagerduty/client.go
  • pkg/pagerduty/mocks/clientMock.go
  • pkg/ssm/mocks/mock_ssmclient.go
  • pkg/utils/cluster.go
  • pkg/utils/mocks/ClusterMock.go
  • pkg/utils/mocks/shellCheckerMock.go
  • pkg/utils/shell.go
💤 Files with no reviewable changes (1)
  • make.Dockerfile

Comment thread Makefile
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Apr 15, 2026

@cblecker: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions 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-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 53.97%. Comparing base (849d479) to head (0c1ae6e).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #925   +/-   ##
=======================================
  Coverage   53.97%   53.97%           
=======================================
  Files          88       88           
  Lines        6662     6662           
=======================================
  Hits         3596     3596           
  Misses       2597     2597           
  Partials      469      469           
Files with missing lines Coverage Δ
cmd/ocm-backplane/cloud/ssm.go 56.08% <ø> (ø)
pkg/backplaneapi/clientUtils.go 35.44% <ø> (ø)
pkg/cli/config/api_client.go 71.92% <ø> (ø)
pkg/cli/session/session.go 50.44% <ø> (ø)
pkg/healthcheck/connectivity_checks.go 8.43% <ø> (ø)
pkg/info/buildInfo.go 100.00% <ø> (ø)
pkg/info/info.go 100.00% <ø> (ø)
pkg/jira/issueService.go 0.00% <ø> (ø)
pkg/ocm/ocm.go 7.30% <ø> (ø)
pkg/pagerduty/client.go 53.84% <ø> (ø)
... and 2 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@xiaoyu74
Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Apr 16, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Apr 16, 2026

[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

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 16, 2026
@openshift-merge-bot openshift-merge-bot bot merged commit 42726e4 into openshift:main Apr 16, 2026
9 checks passed
@cblecker cblecker deleted the fix/goreleaser-v2-mockgen-go-tool branch April 17, 2026 01:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants