Skip to content

ci: use mise for tool management#1053

Merged
phm07 merged 3 commits into
mainfrom
mise
Jun 5, 2025
Merged

ci: use mise for tool management#1053
phm07 merged 3 commits into
mainfrom
mise

Conversation

@phm07
Copy link
Copy Markdown
Contributor

@phm07 phm07 commented May 22, 2025

This PR introduces mise to manage and install tools for our dev environments and CI.
It cleans up our messy tool situation, where we previously had /tools.go, /tools/go.mod and some manually installed tools as well. It also replaces GitHub actions used for installing tools. Since the action is cached, installing Go + all needed tools only takes 3 seconds, where it before took 9 seconds just to install Go alone, which is another nice benefit.

@phm07 phm07 self-assigned this May 22, 2025
@codecov
Copy link
Copy Markdown

codecov Bot commented May 22, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.34%. Comparing base (3df4aa3) to head (a4c0490).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1053   +/-   ##
=======================================
  Coverage   70.34%   70.34%           
=======================================
  Files         247      247           
  Lines       10873    10873           
=======================================
  Hits         7649     7649           
  Misses       2547     2547           
  Partials      677      677           
Flag Coverage Δ
e2e 50.66% <ø> (+0.02%) ⬆️
unit 63.28% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@phm07 phm07 marked this pull request as ready for review May 22, 2025 14:12
@phm07 phm07 requested a review from a team as a code owner May 22, 2025 14:12
@apricote
Copy link
Copy Markdown
Member

Running go generate ./... fails for me with these errors:

➜  cli git:(mise) ✗ go generate ./...
prog.go:12:2: no required module provides package github.com/golang/mock/mockgen/model; to add it:
        go get github.com/golang/mock/mockgen/model
prog.go:12:2: no required module provides package github.com/golang/mock/mockgen/model; to add it:
        go get github.com/golang/mock/mockgen/model
prog.go:12:2: no required module provides package github.com/golang/mock/mockgen/model: go.mod file not found in current directory or any parent directory; see 'go help modules'
prog.go:14:2: no required module provides package github.com/hetznercloud/cli/internal/hcapi2: go.mod file not found in current directory or any parent directory; see 'go help modules'
2025/05/22 16:20:42 Loading input failed: exit status 1
internal/hcapi2/mock/mock_gen.go:3: running "mockgen": exit status 1
prog.go:12:2: no required module provides package github.com/golang/mock/mockgen/model; to add it:
        go get github.com/golang/mock/mockgen/model
prog.go:12:2: no required module provides package github.com/golang/mock/mockgen/model; to add it:
        go get github.com/golang/mock/mockgen/model
prog.go:12:2: no required module provides package github.com/golang/mock/mockgen/model: go.mod file not found in current directory or any parent directory; see 'go help modules'
prog.go:14:2: no required module provides package github.com/hetznercloud/cli/internal/state: go.mod file not found in current directory or any parent directory; see 'go help modules'
2025/05/22 16:20:43 Loading input failed: exit status 1
internal/state/command_helpers.go:11: running "mockgen": exit status 1
prog.go:12:2: no required module provides package github.com/golang/mock/mockgen/model; to add it:
        go get github.com/golang/mock/mockgen/model
prog.go:12:2: no required module provides package github.com/golang/mock/mockgen/model; to add it:
        go get github.com/golang/mock/mockgen/model
prog.go:12:2: no required module provides package github.com/golang/mock/mockgen/model: go.mod file not found in current directory or any parent directory; see 'go help modules'
prog.go:14:2: no required module provides package github.com/hetznercloud/cli/internal/testutil/terminal: go.mod file not found in current directory or any parent directory; see 'go help modules'
2025/05/22 16:20:43 Loading input failed: exit status 1
internal/testutil/terminal/terminal.go:9: running "mockgen": exit status 1

Not sure how that is related to the changes from this PR. It does not happen on main

@apricote
Copy link
Copy Markdown
Member

Works after yeeting mockgen from ~/go/bin/mockgen. Unfortunate that mise does not override this.

@jooola
Copy link
Copy Markdown
Member

jooola commented May 22, 2025

Works after yeeting mockgen from ~/go/bin/mockgen. Unfortunate that mise does not override this.

I thought mise would keep the version of the binaries locally, instead of altering my entire system.

Can we prevent mise from touching the entire system?

@apricote
Copy link
Copy Markdown
Member

It keeps the versions "locally" and appends the path through eval $(mise activate zsh) (can be run automatically with direnv or mise hooks for zsh|bash|fish|nushell).

In cli this branch:

$ which goreleaser
/home/julian/.local/share/mise/installs/goreleaser/v2.9.0/goreleaser

I think the issue for this bug may be related to my local $PATH setup where ~/go/bin is currently before the mise paths.

@phm07
Copy link
Copy Markdown
Contributor Author

phm07 commented May 22, 2025

Yes, I think there is a wrong order in PATH. Not sure if it matters that the binary is called in a //go:generate statement.

@phm07
Copy link
Copy Markdown
Contributor Author

phm07 commented May 22, 2025

Adding this option to [settings] in mise.toml should fix it:
https://mise.jdx.dev/configuration/settings.html#activate_aggressive

@phm07
Copy link
Copy Markdown
Contributor Author

phm07 commented May 23, 2025

@apricote Can you confirm that 30cf16269613531dc2ba47e094a99b6bbed4138d fixes the issue for your setup?

@apricote
Copy link
Copy Markdown
Member

@phm07 and I took another look at this. Turns out it's Jetbrains Goland that adds the duplicate ~/go/bin to my $PATH at the wrong location.

I was able to get this fixed by disabling Tools > Terminal > Shell integration, which stops the Goland integrated terminal from adding more things to the PATH. mise now works great!

Comment thread .github/workflows/build.yml Outdated
Comment thread mise.toml Outdated
Comment thread mise.toml Outdated
Comment thread mise.toml Outdated
@jooola
Copy link
Copy Markdown
Member

jooola commented May 27, 2025

Is there a plan on how to install tool that are not supported by mise? For example installing a external-dns binary?

@phm07
Copy link
Copy Markdown
Contributor Author

phm07 commented May 30, 2025

Is there a plan on how to install tool that are not supported by mise? For example installing a external-dns binary?

mise doesn't need to explicitly support tools. For each installation method there are various backends.

@phm07 phm07 merged commit a04d3f7 into main Jun 5, 2025
6 checks passed
@phm07 phm07 deleted the mise branch June 5, 2025 14:07
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.

3 participants