-
Notifications
You must be signed in to change notification settings - Fork 1.6k
🐛 (alpha generate command): Ensure kubebuilder reuses its own binary instead of relying on $PATH #5081
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
🐛 (alpha generate command): Ensure kubebuilder reuses its own binary instead of relying on $PATH #5081
Conversation
Fix Kubebuilder executable path not found for `kubebuilder alpha generate` command.
The committers listed above are authorized under a signed CLA. |
Welcome @ashishkpathak-connect! |
Hi @ashishkpathak-connect. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the 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. |
Upon checking os.Executable() api, I found that it has a support for darwin too. Details at https://cs.opensource.google/go/go/+/refs/tags/go1.25.1:src/os/executable_darwin.go So, I used os.Executable to ensure the binary "kubebuilder" which was invoked to call |
@ashishkpathak-connect: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
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. |
Below Test shows kubebuilder executable was correctly invoked even though it didn't not exist in PATH. bash-3.2$ which kubebuilder |
} | ||
|
||
return realPath, nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will it work fine for Mac os as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes Camila. Below is a test from Mac os which shows it worked successfully:
bash-3.2$ sw_vers | head -n 2
ProductName: macOS
ProductVersion: 15.6.1
bash-3.2$ basename `pwd`
test4
bash-3.2$ which kubebuilder
bash-3.2$ echo $?
1
bash-3.2$ ~/opensource2/kubebuilder/bin/kubebuilder alpha generate
WARN Using current working directory to re-scaffold the project
WARN This directory will be cleaned up and all files removed before the re-generation
INFO Cleaning directory dir=/tmp/test4
INFO Running cleanup
INFO Running cleanup
INFO kubebuilder init
INFO Writing kustomize manifests for you to edit...
INFO Writing scaffold for you to edit...
INFO Get controller runtime
INFO Update dependencies
Next: define a resource with:
$ kubebuilder create api
INFO Grafana plugin not found, skipping migration
INFO Auto Update plugin not found, skipping migration
INFO Deploy-image plugin not found, skipping migration
INFO Running make manifests
mkdir -p /tmp/test4/bin
Downloading sigs.k8s.io/controller-tools/cmd/controller-gen@v0.19.0
/tmp/test4/bin/controller-gen rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
INFO Running make generate
/tmp/test4/bin/controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..."
INFO Running make fmt
go fmt ./...
INFO Running make vet
go vet ./...
INFO Running make lint-fix
Downloading github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.4.0
/tmp/test4/bin/golangci-lint run --fix
0 issues.
bash-3.2$ echo $?
0
/ok-to-test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/ok-to-test
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ashishkpathak-connect, camilamacedo86 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 |
Fix Kubebuilder executable path not found for
kubebuilder alpha generate
command.Fixes #4900