-
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
🐛 Add validation for the main.go file present in root directory #1726
Conversation
Hi @prafull01. 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. |
/cc @camilamacedo86 |
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.
/approve
/ok-to-test
Great work 🥇
/cc @gabbifish |
pkg/plugin/v2/api.go
Outdated
@@ -131,6 +134,11 @@ func (p *createAPIPlugin) Validate() error { | |||
return err | |||
} | |||
|
|||
// check if main.go is present in the root directory | |||
if _, err := os.Stat(DefaultMainPath); os.IsNotExist(err) { |
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 doing this break the current workflow that allows kubebuilder create api
to create all necessary files even though it returns an 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.
It would be a bug fix but I agree with you. let's apply it only in v3+ plugin. @prafull01 could you please do this change?
/hold
until add only to v3+
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.
Thanks for validating my suspicions.
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.
Done.. Thanks @christopherhein for pointing it out.
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
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: camilamacedo86, christopherhein, prafull01 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 |
/hold cancel |
Description of the Change:
Added validation to check if main.go is present in the root directory or not.
Added the change for v2 and v3 as this is a bug fix.
Motivation of the change:
If user moves the main.go file and then tries to create any resources like webhook, the operation is done half way, the webhook gets created but kb errors out when trying to write to main file. This should be early detected and the operation should not be allowed at all.
Fixes: #1719