Skip to content

build: run mockery as a go tool (MK8S-516) - #91

Merged
ezekiel-alexrod merged 1 commit into
mainfrom
improvement/MK8S-516-mockery-go-tool
Nov 19, 2026
Merged

ezekiel-alexrod merged 1 commit into
mainfrom
improvement/MK8S-516-mockery-go-tool

Conversation

@ezekiel-alexrod

Copy link
Copy Markdown
Contributor

mockery is now a tool in go.mod, run with go tool mockery, instead of a binary installed apart in the CI generate job.

Problem

//go:generate mockery called a mockery binary that had to be installed first. It was installed in the CI generate job, each with its own version and its own Renovate annotation on the GitHub release, so the version could drift between them, and go generate failed on a machine without it. The Go code generators of our other repos are tools in go.mod (oapi-codegen in metalk8s-registry-node-agent, mockery in raidmgmt), updated by Renovate like any other module.

What changes

  • go get -tool github.com/vektra/mockery/v3@v3.9.1: the version already used, now pinned once in go.mod.
  • //go:generate go tool mockery: go generate ./... works with Go alone.
  • The Install mockery CI step is removed.

Testing

Check Result
go generate ./... with Go 1.27.4 the committed mocks do not change
go build ./..., go vet ./... OK
go test ./pkg/... OK

Out of scope


Refs: MK8S-516

mockery was installed apart, at a version pinned twice (CI step and
devcontainer), and a generator bump only reached them through a
Renovate annotation. Declare it as a tool in go.mod and call it with
go tool mockery: the version is pinned once, Renovate updates it with
the other Go modules, and go generate works without installing
anything. The generated mocks do not change.

Refs: MK8S-516
@ezekiel-alexrod
ezekiel-alexrod merged commit 2e84dcc into main Nov 19, 2026
12 checks passed
@ezekiel-alexrod
ezekiel-alexrod deleted the improvement/MK8S-516-mockery-go-tool branch November 19, 2026 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants