-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
🐛 (go/v4): Scaffold when no boilerplate file #3378
Conversation
|
Welcome @yyy1000! |
Hi @yyy1000. 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/test-infra repository. |
@@ -67,7 +67,7 @@ func (s *apiScaffolder) Scaffold() error { | |||
// Load the boilerplate | |||
boilerplate, err := afero.ReadFile(s.fs.FS, hack.DefaultBoilerplatePath) | |||
if err != 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.
could we specifyically check for fileNotFound error and skip with errors.Is(err, afero.ErrFileNotFound)
. In case its something else (like permission issue), we can return the error.
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.
+1 in in the above suggestion.
We need only to use an empty string when we know the file does not exist.
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.
Thank you! It's very helpful. 😀 I made changes on this.
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.
/ok-to-test
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: camilamacedo86, yyy1000 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 |
//test pull-kubebuilder-e2e-k8s-1-24-7 |
Also, /lgtm Since address the Varsha suggestions either. |
/pull-kubebuilder-e2e-k8s-1-24-7 |
/test pull-kubebuilder-e2e-k8s-1-24-7 |
/retest |
1 similar comment
/retest |
Description
This pull request addresses issue #3373, which prevented kubebuilder from creating an API when no boilerplate file was present.
I have tested the changes locally with the following steps:
Additionally, I tried to make some changes that enable the 'create api' command to modify the 'Makefile' when there's no boilerplate file and let the user skip step 4 altogether, making it possible to successfully run 'post-scaffold'(make generate). It seems not a little change, but I'm glad to do that if it is worth doing. :)