kubernetes-sigs / controller-tools

Tools to use with the controller-runtime libraries
Apache License 2.0
737 stars 420 forks source link

controller-gen cannot be properly versioned without patching the existing code #1046

Open josvazg opened 2 months ago

josvazg commented 2 months ago

The version computing code assumes the usage of the controller-gen will always be as a module:

$ go get github.com/controller-tools/cmd/controller-gen@v0.16.1

Moreover, downloading the official released binaries from this repo directly they still render (devel)as the binary version.

This is not CI or reproducible environment friendly. Ideally, you would define your dependency version on some file, then just have it available in your environment.

Using the module approach and updating your go.mod does not make the binary available after go mod tidy, so the CI will not be able to use controller-gen.

There is no ready available packaging such as with brew or Debian.

Reproducible builds with versioning exist from nix, by patching the versioning code in this repository.

Given than using the CLI generator tool as a module is not natively supported by Go, and that a binary distribution of some kind is required, we would like to propose the following change.

We are ready to follow up with a patch for this.

s-urbaniak commented 2 months ago

cc @vincepri

s-urbaniak commented 2 months ago

and cc @sbueringer 🙏

sbueringer commented 2 months ago

@josvazg @s-urbaniak Thx for opening the issue. I missed checking for the version when implementing the binary releases.

Proposal sounds good to me, feel free to open a PR

josvazg commented 2 months ago

Thanks @sbueringer !

Just posted #1049