Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a version command or option to controller-gen #259

Closed
alexkreidler opened this issue Jul 17, 2019 · 9 comments · Fixed by #332
Closed

Add a version command or option to controller-gen #259

alexkreidler opened this issue Jul 17, 2019 · 9 comments · Fixed by #332
Assignees
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature. priority/backlog Higher priority than priority/awaiting-more-evidence.

Comments

@alexkreidler
Copy link

It would be great to know which version of controller-gen we're using in our kubebuilder projects to better diagnose errors and help the community.

Please add a version command or --version or -v flags to controller-gen to help us with this. Thanks a ton!

@jiachengxu
Copy link
Contributor

Yes, this would be helpful, since I encountered a similar issue with kubebuilder :kubernetes-sigs/kubebuilder#909. I could try to work on this if help is needed.

@DirectXMan12
Copy link
Contributor

/kind feature
/help-wanted

You can more-or-less copy the ldflags/git approach from other projects or bits of kubernetes. If you've done something similar before, or are willing to do a bit of bash/makefile spelunking, this is a reasonable starter issue.

@k8s-ci-robot k8s-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Aug 5, 2019
@DirectXMan12
Copy link
Contributor

/priority backlog

@k8s-ci-robot k8s-ci-robot added the priority/backlog Higher priority than priority/awaiting-more-evidence. label Aug 5, 2019
@DirectXMan12
Copy link
Contributor

/help

@k8s-ci-robot
Copy link
Contributor

@DirectXMan12:
This request has been marked as needing help from a contributor.

Please ensure the request meets the requirements listed here.

If this request no longer meets these requirements, the label can be removed
by commenting with the /remove-help command.

In response to this:

/help

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 k8s-ci-robot added the help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. label Aug 5, 2019
@DirectXMan12
Copy link
Contributor

(we'd probably add this as a --version flag)

@jiachengxu
Copy link
Contributor

Hi @DirectXMan12, if help is needed, I am willing to work on this issue, any more hints on this?

@DirectXMan12
Copy link
Contributor

kustomize uses goreleaser, so it's not 1-to-1, but you can get the gist of the general technique here: https://github.com/kubernetes-sigs/kustomize/blob/master/releasing/goreleaser.yaml#L11 / https://github.com/kubernetes-sigs/kustomize/blob/master/pkg/commands/misc/version.go

Instead of goreleaser, we'd use a script to grab the version info. The general trick is to run something like git describe --tags --abbrev=14 and pull the version and commit out of that.
metrics-server uses a giant makefile for doing it, but has extra fancy footwork to stay compatible with what's done in kubernetes/kubernetes: https://github.com/kubernetes-incubator/metrics-server/blob/master/hack/Makefile.buildinfo. I don't think we need to get that complicated, though.

On further thought, since we're generally go-installing, we probably need to make use of https://golang.org/pkg/runtime/debug/#BuildInfo to grab the version info at runtime. Then we can print that out.

@dlespiau
Copy link
Contributor

dlespiau commented Oct 1, 2019

/assign @dlespiau

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature. priority/backlog Higher priority than priority/awaiting-more-evidence.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants