Closed
Description
The solution implemented in PR #4481 aimed to allow Kubebuilder to be used as a Golang module, but it inadvertently broke the injection of version-related values during the build process.
What Broke? What's Expected?
Before (Expected Output)
Running kubebuilder version
before the change correctly injected version information:
$ kubebuilder version
Version: main.version{KubeBuilderVersion:"4.5.0", KubernetesVendor:"1.31.0", GitCommit:"7153119ca900994b70507edbde59771ac824f2d9", BuildDate:"2025-01-21T08:46:54Z", GoOs:"darwin", GoArch:"arm64"}
After (Broken Output)
After applying the changes in PR #4481 and creating a pre-release, the version information is missing, showing default values instead:
$ kubebuilder version
Version: cmd.version{KubeBuilderVersion:"(devel)", KubernetesVendor:"unknown", GitCommit:"$Format:%H$", BuildDate:"1970-01-01T00:00:00Z", GoOs:"unknown", GoArch:"unknown"}
This indicates that ldflags
are no longer injecting the expected values.
Reproducing the Issue
- Get the PR changes PR #4481
- Use go releaser to build the bin locally
- Check the binary
Next Steps
To move forward, we will revert PR #4481 for the 4.5.1 patch release to restore version injection. After that, we can revisit the issue, properly test it, and ensure the solution works before the next release.