Add Orgs sharding for Blunderbuss#237
Conversation
|
Hi @dhaiducek. 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. DetailsInstructions 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 project configuration. |
|
/ok-to-test |
|
/cc |
|
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
|
/remove-lifecycle stale |
jmguzik
left a comment
There was a problem hiding this comment.
@dhaiducek Are you still interested and willing to push it further?
I feel really bad about this one as I was involved here kubernetes/test-infra#28169 and I think we even pushed it, but missed detail about pointer. Correct me if I am wrong.
This code was reviewed so generally from my POV there is nothing major to comment. This change is huge though and it can affect again prow installations, including openshift one. I am just loudly thinking how we should approach the testing regarding the topic.
It would be ideal to test it in some kind of puppy environment, but it's not straightforward to setup, but maybe worth a try.
Hey @jmguzik! Yes, I'm willing to dive back into it--it's still relevant for us. No hard feelings--I got pretty gun-shy myself when it merged and broke things and had to be reverted, and I know it's a massive change. But yes, as I recall it broke last time because the implementation didn't use a pointer for the global config and didn't correctly identify when another global config wasn't specified. I wouldn't know the first thing about setting up a sandbox Prow env, but I can try or let me know if there's anything I can do to help! Before, if I'm looking at the thread correctly, it failed during the rehearsal CI and never made it into production: https://redhat-internal.slack.com/archives/CBN38N3MW/p1683036380568929 |
|
I'll test that on puppy env during next shift week to see if the current impl behaves 😉 |
|
/area plugins |
569d41b to
38c961a
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: dhaiducek The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
jmguzik
left a comment
There was a problem hiding this comment.
I would like to get this closer to merging this week. Left some comments/suggestions.
| } | ||
|
|
||
| // Return base config | ||
| return *c.Blunderbuss.BlunderbussConfig |
There was a problem hiding this comment.
| return *c.Blunderbuss.BlunderbussConfig | |
| if c.Blunderbuss.BlunderbussConfig != nil { | |
| return *c.Blunderbuss.BlunderbussConfig | |
| } | |
| return BlunderbussConfig{} |
makes sense?
There was a problem hiding this comment.
It could make sense, but I'm not sure it's necessary since the nil case is handled here in setDefaults():
https://github.com/kubernetes-sigs/prow/pull/237/files#diff-19905b632cb1213462d0e01d336d4f49504923b1365fceca80506f7f9a755a61R1129-R1132
| b.BlunderbussConfig = other.BlunderbussConfig | ||
| } else if !reflect.DeepEqual(b.BlunderbussConfig, other.BlunderbussConfig) { | ||
| // Add error when both configs declare different global defaults | ||
| errs = append(errs, fmt.Errorf("global configurations for blunderbuss do not match")) |
There was a problem hiding this comment.
should that not be stopping error?
There was a problem hiding this comment.
Not necessarily. By continuing on, it can aggregate all of the errors, not just the mismatch of the default values.
|
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
dhaiducek
left a comment
There was a problem hiding this comment.
/remove-lifecycle stale
Sorry, I let this one flounder and get stale--I've left some responses to the review comments.
| b.BlunderbussConfig = other.BlunderbussConfig | ||
| } else if !reflect.DeepEqual(b.BlunderbussConfig, other.BlunderbussConfig) { | ||
| // Add error when both configs declare different global defaults | ||
| errs = append(errs, fmt.Errorf("global configurations for blunderbuss do not match")) |
There was a problem hiding this comment.
Not necessarily. By continuing on, it can aggregate all of the errors, not just the mismatch of the default values.
| } | ||
|
|
||
| // Return base config | ||
| return *c.Blunderbuss.BlunderbussConfig |
There was a problem hiding this comment.
It could make sense, but I'm not sure it's necessary since the nil case is handled here in setDefaults():
https://github.com/kubernetes-sigs/prow/pull/237/files#diff-19905b632cb1213462d0e01d336d4f49504923b1365fceca80506f7f9a755a61R1129-R1132
3a277ca to
2bbd15e
Compare
Using a pointer lets sharding determine whether a config had been provided so they can be properly compared. If one is not provided, this also instantiates one in `setDefaults()`, which is called following the sharding logic. Signed-off-by: Dale Haiducek <19750917+dhaiducek@users.noreply.github.com>
2bbd15e to
9556627
Compare
|
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
|
/remove-lifecycle stale |
|
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
|
/remove-lifecycle stale |
|
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
|
/remove-lifecycle stale |
|
We recently got a very good reason to get this merged, thanks for keeping it fresh! I started to review the PR and it looks good skimmed, I'll do some testing and look a bit closer and I hope we'll get this done soon. |
Sounds great, thanks @petr-muller! I'll keep an eye out for reviews/followups (and might have to look over the code to refresh myself on it too! 😅). |
petr-muller
left a comment
There was a problem hiding this comment.
wow, it was criminal of us to not merge this sooner, it's pretty polished
my only question would be whether the handleStatus path should get the fragment config instead of the full one like the other handlers (inline)
I also noticed the validation is not done on fragments but that one is not that important as there's barely any validation there (although, in sharded configs validation becomes more important, so adding a shard validation that would do more checks would be a great followup)
| func handleStatusEvent(pc plugins.Agent, se github.StatusEvent) error { | ||
| if se.State == "" || se.Context == "" || se.Description == "" { | ||
| return fmt.Errorf("invalid status event delivered with empty state/context/description") | ||
| } | ||
|
|
||
| return handleStatus( | ||
| pc.GitHubClient, | ||
| pc.OwnersClient, | ||
| pc.Logger, | ||
| pc.PluginConfig.Blunderbuss, | ||
| se.SHA, | ||
| se.Context, | ||
| se.State, | ||
| se.Description, | ||
| &se.Repo, | ||
| ) | ||
|
|
||
| } | ||
|
|
||
| func handleStatus(ghc githubClient, roc repoownersClient, log *logrus.Entry, config plugins.Blunderbuss, sha string, context string, state string, description string, repo *github.Repo) error { |
There was a problem hiding this comment.
I think handleStatus and handleStatusEvent need to weave the BlunderbussFor(...) result instead of the full config from PluginConfig, right?
| func validateBlunderbuss(b *Blunderbuss) error { | ||
| if b.ReviewerCount != nil && *b.ReviewerCount < 1 { | ||
| return fmt.Errorf("invalid request_count: %v (needs to be positive)", *b.ReviewerCount) | ||
| } | ||
| return nil | ||
| } |
There was a problem hiding this comment.
I dont thick the check is that useful (among other things, other fields are not checked...) but this should descend into b.Orgs and check the layers below.
Using a pointer lets sharding determine whether a config had been provided so they can be properly compared. If one is not provided, this also instantiates one in
setDefaults(), which is called following the sharding logic.Migrated from: