-
Couldn't load subscription status.
- Fork 1
Description
What happened?
The crossplane-diff version command was not reporting the correct version for the crossplane-diff binary.
Instead, it was attempting to report the version from the upstream github.com/crossplane/crossplane
dependency, which resulted in either an empty version string or the wrong version being displayed.
Root cause:
crossplane-diffwas importing the version command directly from
github.com/crossplane/crossplane/v2/cmd/crank/version- The Earthfile was attempting to inject version information into
github.com/crossplane/crossplane/internal/version.versionusing ldflags - This approach doesn't work because you cannot inject ldflags into vendored/downloaded dependencies
- The variable name
CROSSPLANE_VERSIONwas overloaded - used both for the upstream Crossplane image tag (e.g.,
release-1.20) and the crossplane-diff binary version, causing confusion
Expected behavior:
When running crossplane-diff version --client, it should display the actual version of the crossplane-diff
binary (e.g., v0.4.0 or v0.0.0-{timestamp}-{git-hash} for dev builds).
Actual behavior:
The version command displayed an empty string or incorrect version information.
How can we reproduce it?
Before the fix:
- Clone the crossplane-diff repository at a commit before the fix
- Build the binary:
go build -o crossplane-diff ./cmd/diff - Run:
./crossplane-diff version --client - Observe that the version is empty or incorrect
Or using Earthly:
- Build with Earthly:
earthly +build - Run:
./_output/bin/darwin_arm64/crossplane-diff version --client(adjust path for your platform) - Observe the version output is empty or incorrect
What environment did it happen in?
Crossplane version: n/a