-
Notifications
You must be signed in to change notification settings - Fork 112
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
Handle empty alias group case #368
base: main
Are you sure you want to change the base?
Handle empty alias group case #368
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: nikhilnishad-goog 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 |
Welcome @nikhilnishad-goog! |
Hi @nikhilnishad-goog. 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. |
✅ Deploy Preview for k8s-prow ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
/ok-to-test |
@nikhilnishad-goog: 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. |
/assign @tuminoid |
/ok-to-test |
/test pull-prow-integration |
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 taking a look!
Took initial look at this, mostly nits.
I'm also thinking if we really should error out in unmarshalling the aliases, or just gracefully accept a group was empty and did not add any usernames. As a user, I'd kinda hate the fact that if I don't have any people left in a group, I'd need to comment out the alias and everywhere it is referred.
@tuminoid Thanks for taking a look.
I am in the opinion of throwing when unmarshalling, ideally, there should be no dead code (which includes empty groups that are not meant to have any effect anywhere). The tests should match that behavior. Also, there are some missed cases, i will update the PR soon. |
…t failures are seen.
pkg/repoowners/repoowners.go
Outdated
// Convert []interface{} to []string | ||
var members []string | ||
for _, member := range v { | ||
members = append(members, member.(string)) |
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.
members = append(members, member.(string)) | |
str, ok := member.(string) | |
if !ok { | |
return result, fmt.Errorf(....) | |
} |
type check here?
For this issue. Modifies repoowners.go to handle cases where the file has an alias group but does not have any user name listed in it.
There are multiple acceptable yamls that are being not parsed explictly and edge cases not handled. Examples are -
All of these are valid yamls, that can cause silent failures like the one mentioned in #360 .
Fixes #360