kubebuilder
kubebuilder copied to clipboard
:sparkles: Infer version information for go-install
trafficstars
Now that kubebuilder is go-installable :tada:, this is a small improvement to fetch more information when dealing with go install installations.
With this PR, we will now infer correctly GitCommit, BuildDate, GoOs and GoArch for normal GoReleaser builds but also go install installations.
Also a new field is added for goVersion
Outputs from make build and goreleaser are kept intact:
$ ./bin/kubebuilder version
Version: cmd.version{KubeBuilderVersion:"v4.5.1-10-gd7dd0cba4", KubernetesVendor:"1.32.1", GoVersion:"go1.23.4", GoOs:"linux", GoArch:"amd64", GitCommit:"d7dd0cba43a626e7febb19a3db6d8635b4c6d299", BuildDate:"2025-03-01T11:52:16Z"}
$ ./dist/kubebuilder_linux_amd64_v1/kubebuilder version
Version: cmd.version{KubeBuilderVersion:"4.5.1-SNAPSHOT-d7dd0cba4", KubernetesVendor:"1.32.1", GoVersion:"go1.23.4", GoOs:"linux", GoArch:"amd64", GitCommit:"d7dd0cba43a626e7febb19a3db6d8635b4c6d299", BuildDate:"2025-03-01T11:53:00Z"}