Skip to content

Conversation

@vitorfloriano
Copy link
Contributor

@vitorfloriano vitorfloriano commented Nov 18, 2025

WIP: This PR tries to make the kubebuilder version output a little more human-readable with as little disruption as possible.

  • Current:
$ kubebuilder version
Version: cmd.version{KubeBuilderVersion:"v4.10.1", KubernetesVendor:"1.34.1", GitCommit:"$Format:%H$", BuildDate:"1970-01-01T00:00:00Z", GoOs:"unknown", GoArch:"unknown"}
  • After:
$ kubebuilder version
Kubebuilder:    (devel)
Kubernetes:     1.34.1
Git Commit:     0f74925f59bab043d7fe6a44c68ccd45fd52475d
Build date:     2025-11-18T02:51:55Z
OS/Arch:        linux/amd64

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Nov 18, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: vitorfloriano
Once this PR has been reviewed and has the lgtm label, please assign kavinjsir for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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
Copy link
Contributor

Hi @vitorfloriano. Thanks for your PR.

I'm waiting for a github.com member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 18, 2025
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 19, 2025
@vitorfloriano
Copy link
Contributor Author

Hi @camilamacedo86 could you help me out on this one?

I was trying to not be so disruptive about this change by using a map[string]string to print each version with its value, but I figured it was not an idiomatic approach so I changed it to a struct, but I had to move the Version struct to the cli package to avoid circular imports.

Also, I saw that a previous PR (#4898) also tried to add json output to the version subcommand. Do you think I should try to add that in this PR as well or should I do it as a follow-up?

One more thing: I checked that the version field is correctly being recorded in the PROJECT file.

I ran make install in my branch then I verified the version:

$ kubebuilder version
Kubebuilder:	v4.10.0-6-gae97bbf8f
Kubernetes:	1.34.1
Git Commit:	ae97bbf8fd9a84ff840586c67c2c121393e8e905
Build Date:	2025-11-19T19:29:57Z
OS/Arch:	linux/amd64

Then in a project I initialized for testing I checked that the cliVersion field is still there:

$ cat PROJECT
# Code generated by tool. DO NOT EDIT.
# This file is used to track the info used to scaffold your project
# and allow the plugins properly work.
# More info: https://book.kubebuilder.io/reference/project-config.html
cliVersion: v4.10.0-6-gae97bbf8f
domain: my.domain
layout:
- go.kubebuilder.io/v4
projectName: test-version
repo: github.com/vitorfloriano/test-version
version: "3"

PTAL 🙏🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants