kustomize icon indicating copy to clipboard operation
kustomize copied to clipboard

Improve kustomize version output

Open KnVerey opened this issue 3 years ago • 5 comments

  • Take advantage of go1.18's BuildInfo, when available, with fallback on the constants set by ldflags we use today. Should fix https://github.com/kubernetes-sigs/kustomize/issues/4617.
  • Add json and yaml output formats.
  • Deprecate the Go struct output that is currently the default, to be replaced with a simple semver string. kubectl is doing the same: https://github.com/kubernetes/kubernetes/pull/108987
  • Change the short output from a Go struct with whitespace errors to a simple semver string, to match kubectl.
  • Add more of the build info kubectl version offers, when available from BuildInfo: goVersion, gitTreeState

🚨 TODO: verify that the information will really be correct on a tagged commit, and in the goreleaser context. Most of the information isn't populated in tests: https://github.com/golang/go/issues/33976. Everything looks good on make kustomize (which does go install), but the version is (devel) so not good confirmation.

Local build before

> kustomize version
{Version:unknown GitCommit:$Format:%H$ BuildDate:1970-01-01T00:00:00Z GoOs:darwin GoArch:arm64}

> kustomize version --short
{unknown  1970-01-01T00:00:00Z  }

Local build after

> kustomize version
{Version:(devel) GitCommit:2a0d821bdba197bf70c3883f79b9fad049e84854 GitTreeState:clean BuildDate:2022-05-09T23:45:42Z GoOs:darwin GoArch:arm64 GoVersion:go1.18.1}

> kustomize version --short
Flag --short has been deprecated, and will be removed in the future. The --short output will become the default.
(devel)

> kustomize version -o yaml
version: (devel)
gitCommit: 2a0d821bdba197bf70c3883f79b9fad049e84854
gitTreeState: clean
buildDate: "2022-05-09T23:45:42Z"
goOs: darwin
goArch: arm64
goVersion: go1.18.1

> kustomize version -o json
{
  "version": "(devel)",
  "gitCommit": "67e0a9a2c602a940247cdde08f77b7fb1d5cf8a5",
  "gitTreeState": "clean",
  "buildDate": "2022-05-09T23:57:55Z",
  "goOs": "darwin",
  "goArch": "arm64",
  "goVersion": "go1.18.1"
}

KnVerey avatar May 10 '22 00:05 KnVerey

Skipping CI for Draft Pull Request. If you want CI signal for your change, please convert it to an actual PR. You can still manually trigger a test run with /test all

k8s-ci-robot avatar May 10 '22 00:05 k8s-ci-robot

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: KnVerey

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

k8s-ci-robot avatar May 10 '22 00:05 k8s-ci-robot

/hold on verifying release behaviour will be correct

KnVerey avatar May 10 '22 00:05 KnVerey

@KnVerey: This PR has multiple commits, and the default merge method is: merge. You can request commits to be squashed using the label: tide/merge-method-squash

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar May 10 '22 00:05 k8s-ci-robot

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Aug 08 '22 23:08 k8s-triage-robot

@KnVerey: PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Aug 26 '22 20:08 k8s-ci-robot

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Nov 24 '22 21:11 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot avatar Dec 26 '22 00:12 k8s-triage-robot

Closing in favour of #5000

KnVerey avatar Feb 01 '23 00:02 KnVerey