Skip to content
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 org and org/repo sharding for Blunderbuss #28169

Merged
merged 2 commits into from
Apr 26, 2023

Conversation

dhaiducek
Copy link
Contributor

@dhaiducek dhaiducek commented Dec 2, 2022

Currently we have a bot user whose PRs should be ignored by Blunderbuss, a feature which was implemented in this PR:

However, we can't yet leverage the feature because we need to be able to specify a Blunderbuss configuration at our repo level since the Prow administrators don't want to have the same configuration globally.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Dec 2, 2022
@k8s-ci-robot
Copy link
Contributor

Hi @dhaiducek. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. area/prow Issues or PRs related to prow area/prow/deck Issues or PRs related to prow's deck component area/prow/plugins Issues or PRs related to prow's plugins for the hook component sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 2, 2022
@petr-muller
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Dec 9, 2022
@dhaiducek
Copy link
Contributor Author

/retest

@dhaiducek
Copy link
Contributor Author

Any updates here?

Copy link
Contributor

@jmguzik jmguzik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dhaiducek I see you waited long for the review, but if you are still willing to go through the process and still interested in the PR we can speed things up. I did some entry review of your PR and have some questions/comments.

reviewerCount int
expectedRequested []string
}{
name: "comment with a valid command in an open PR triggers auto-assignment",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the only possible test case? What about different config options?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can add some more test cases to make sure things are wired up. 🙂

I was wondering about that also though, and I'll have to double check this, but it looks like in general sharding replaces the configuration in its entirety rather than checking each value and providing overrides. Am I looking at that correctly?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that is my understanding as well. More test cases would be nice.

@jmguzik
Copy link
Contributor

jmguzik commented Feb 8, 2023

/retest

@dhaiducek dhaiducek force-pushed the blunderbuss-override branch 4 times, most recently from 37bc4c4 to 961d51a Compare February 10, 2023 20:06
@dhaiducek
Copy link
Contributor Author

dhaiducek commented Feb 10, 2023

Sorry for the churn here! Here's the TLDR:

  • I refactored a bit (primarily pulled the BlunderbussFor function up into the Handle*Event functions so that the diff in blunderbuss.go would be less)
  • Wrote tests for MergeFrom (which raised some merging logic bugs that were addressed 🪲) and additional tests in blunderbuss_test.go

I think this should be ready for another review now.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 15, 2023
@k8s-ci-robot
Copy link
Contributor

@dhaiducek: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-test-infra-verify-cri-o 961d51a link true /test pull-test-infra-verify-cri-o

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

@dhaiducek dhaiducek force-pushed the blunderbuss-override branch from 961d51a to 51f33a0 Compare February 15, 2023 22:12
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 15, 2023
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 16, 2023
@jmguzik
Copy link
Contributor

jmguzik commented Feb 16, 2023

@droslean could you take a look? It would be nice to enable it in our prow.

@jmguzik
Copy link
Contributor

jmguzik commented Feb 16, 2023

/cc @droslean

Copy link
Member

@petr-muller petr-muller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll happily approve this! I trust Jakub and I have only skimmed the code; I have one nit about the serialization.

One question: does the implementation follow how the other plugins configs are sharded?

@jmguzik IIRC in the past, when we implemented the other sharding bits it bit us through the "load and save Prow config" job that we had in openshift - it loaded the unsharded config and dumped the sharded one, so this needed manual attention once we deployed the Prow with the changes. Just something to keep in mind.

@jmguzik
Copy link
Contributor

jmguzik commented Feb 23, 2023

@jmguzik IIRC in the past, when we implemented the other sharding bits it bit us through the "load and save Prow config" job that we had in openshift - it loaded the unsharded config and dumped the sharded one, so this needed manual attention once we deployed the Prow with the changes. Just something to keep in mind.

Thanks @petr-muller I suspected something like this can happen.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 9, 2023
Signed-off-by: Dale Haiducek <19750917+dhaiducek@users.noreply.github.com>
@dhaiducek dhaiducek force-pushed the blunderbuss-override branch from 51f33a0 to 00b954e Compare March 9, 2023 16:02
@k8s-ci-robot k8s-ci-robot removed lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Mar 9, 2023
@dhaiducek
Copy link
Contributor Author

Sorry for the delay here--I got caught up with some other work. Thanks for the reviews, @petr-muller and @jmguzik! I've updated the key to snake case.
It sounds like the other comments around sharding are a gotcha around Openshift tooling, or is there something that should be adjusted here?

@dhaiducek
Copy link
Contributor Author

@petr-muller I neglected to answer the sharding alignment question. The answer is "sort of". There isn't an entirely consistent way that configurations are sharded, but I made an attempt to choose and follow other existing conventions.

Most notable, this implementation uses a flattened map, OrgsRepos containing org and org/repo keys pointing to each configuration, which I liked for simplicity:

orgs_repos:
  "org": <configuration>
  "org/repo": <configuration>

Whereas some other sharded configurations (like Tide.context_options, Branch Protection, and Bugzilla) chose to use an Orgs map containing a nested Repos map:

orgs:
  "org":
    <configuration>
    repos:
      "repo": <configuration>

The downside to this implementation I'm realizing now is that it doesn't readily allow for org-specific options in the future like the nested repos map does, but for something like pull request reviews where it's inherently a repository operation, I'm not sure there's a need for org-specific options. But I can adjust it if that should be a consideration.

@jmguzik
Copy link
Contributor

jmguzik commented Mar 23, 2023

@dhaiducek sorry for the late response. While waiting for a comment from @petr-muller, my personal opinion goes toward making it similar to other plugins. So I would vote for option:

orgs:
  "org":
    <configuration>
    repos:
      "repo": <configuration>

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 24, 2023
@dhaiducek dhaiducek force-pushed the blunderbuss-override branch from 70c7b73 to 7624cc6 Compare March 24, 2023 20:06
An expanded config allows for future org-specific configurations.

Signed-off-by: Dale Haiducek <19750917+dhaiducek@users.noreply.github.com>
@dhaiducek dhaiducek force-pushed the blunderbuss-override branch from 7624cc6 to 373c490 Compare March 24, 2023 20:29
@dhaiducek
Copy link
Contributor Author

For consideration, I've updated the struct to use nested orgs and nested repos as discussed in a new commit. It uses a pointer, *BlunderbussConfig, at the organization level to readily determine whether a config was defined there (otherwise, it wouldn't be possible to tell the difference between a configuration with defaults and an empty configuration).

Copy link
Member

@petr-muller petr-muller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Thanks for the effort invested into this, and sorry for it to take this long.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 26, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dhaiducek, jmguzik, petr-muller

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 26, 2023
@k8s-ci-robot k8s-ci-robot merged commit d32ca9c into kubernetes:master Apr 26, 2023
@dhaiducek dhaiducek deleted the blunderbuss-override branch April 26, 2023 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/prow/deck Issues or PRs related to prow's deck component area/prow/plugins Issues or PRs related to prow's plugins for the hook component area/prow Issues or PRs related to prow cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants