[Backport v1.32] fix(kubectl): embed release version metadata and expose --version #3718
All Vouch review confidence checks passed
Residual risk 0.25 = Change Risk (0.63) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.63 · 287 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.339
Shallow Review Depth
shallow_review_depth
0.289
Sensitive Paths
sensitive_paths
0.063
Real PR Conversation Timeline
1 comments
"Review active on #3718"
general
weight: 0.35
tbavelier
Backport e208d5a190b8b4c670c0d6aa454fd5c94b709896 from #3717.
___
What does this PR do?
Embed the release version, full Git commit, and build time in
kubectl-datadogusing GoReleaser's metadata in all four build configurations. Addkubectl datadog --versionto print those values, with a regression test and usage documentation.Motivation
CONTP-2289: published plugin binaries retain the default version
0.0.0because the release workflow runs GoReleaser directly, while the linker flags reference variables defined only in the Makefile. The generic configuration also targets an incorrect package path. Users and support need to identify the installed plugin release.Additional Notes
The platform-specific release configurations have contained these flags since their introduction in #697. This changes the configuration directly, so the workflow does not need to supply additional environment variables.
The published-artifact acceptance check remains pending until the next release.
Minimum Agent Versions
No new minimum version requirements.
Agent: unchanged
Cluster Agent: unchanged
Describe your test plan
go test ./cmd/kubectl-datadog/... ./pkg/version.make lint.goreleaser checkusing GoReleaser 2.4.1.goreleaser build --snapshot --skip=before --config .goreleaser-for-darwin.yaml; run the native binary with--versionand compare its version, commit, and build time againstdist/metadata.json.kubectl-datadog --versionreports that release's version, commit, and build time.Checklist
bug,enhancement,refactoring,documentation,tooling, and/ordependenciesqa/skip-qalabel[1]: https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits
[CONTP-2289]: https://datadoghq.atlassian.net/browse/CONTP-2289?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ