-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
Missing features to port Angular monorepo #13
Comments
Hey, that sounds epic! Let's see what we'll have to do here to fix this!
I don't know if I understood you correctly, but I think that this is already possible to achieve. There is no limit on how many Does the code in the following example do what you're looking for? Lines 4 to 28 in 56e551f
In the Angular CODEOWNERS, it seems like the global approvers are almost global, some paths like What do you think of an API where it's possible to set a To opt-out from the global team having access to a package/path, the Do you think that an API like that would fit your needs? |
Thanks for replying! I'm making some more progress on it. I figured that I could add more codeowners() targets, one per pattern. It's workable but the problem is the generator target is going to have hundreds of lines in the owners list. There isn't any grouping, or a way to have a package propagate the codeowners from its subpackages in a way that preserves the encapulation. So someone trying to update owners for their own subdir still has to nag a global approver to let them change the generate_codeowners target to add their line, and that subverts the point of distributed ownership in a monorepo. I think we need some kind of forwarding target so there's a tree, instead of the current flat two levels of rules. Does that make sense? I can prototype something to fix it. For global approval I've added a macro we'll call through. So a typical package has only
We already load The macro itself gets a bunch of logic to reproduce the current CODEOWNERS file. See it here: I think a wrapper macro to set defaults for rules is a fine pattern, would suggest it to anyone who wants that feature, so I don't think we need to add anything. |
Aha, I see what you're getting at. I'll hack something together and let you test it out. One
The macro solution is much better than what I had in mind! Once your changes hits angular/angular we can refer to that solution from the documentation in this project. I did implement my idea anyways, it's currently available for testing in #14, but as the macro setup is more flexible, I'll likely not merge it. |
nice! Take a look at all the comments in https://github.com/alexeagle/angular/blob/codeowners/.github/BUILD.bazel - that's what's left to make the same codeowners as Angular has now. I think this nesting feature is nicely minimal and lets a package encapsulate its own list of subpackages so that's nice. Next, let's say a package needs 10 different owners patterns. Your scheme would require that one package BUILD file to have
which is super-verbose. In particular I'm forced to choose a name for each rule and then put the name in the list, but the name is meaningless. We really want that one package to have
I can probably implement that in the macro too but I think it belongs in the rule. Final issue is that Angular's code is badly organized, all these |
Actually as I'm rolling it out it seems what I really want is
I've got it working in the macro so I'm not blocked. |
Sweet! I've implemented the |
FYI, I still find it too difficult to register all the codeowners() rules with the generation target. What we really want is just add codeowners to a package and the rest is automated. I got mostly there by scripting it using bazel query and buildozer to automatically discover the codeowners() rules and set them as the
See bazel-contrib/rules_nodejs#1266 maybe we should document this in the readme? |
Yeah, I feel you. In one of the repositories where I've introduced rules_codeowners, there's a CI step that verifies that every So it's epic that you've taken this a step further and automated the process! This could probably be implemented as a runable rule, but that's likely overkill. I'll add both your and my variant to the README. |
Hey @alexeagle and @zegl, I'm a bit late to the party but thought I would chime in. Love the discussion and implementation of some awesome changes that are definitely moving in the right direction.
Your example desired state (and what @zegl implemented) would still require multiple codeowners(
rules = [
"@angular/fw-compiler": [
"guide/angular-compiler-options.md",
"guide/aot-compiler.md",
"guide/aot-metadata-errors.md",
],
....
],
) I think this provides a cleaner interface when considering that one might have end up with a complex
I think we'd be able to accomplish this by rewriting |
I thought about a more complex datastructure but I think the fact that multiple codeowners rules compose makes everything simpler and gives approx. the same ergonomics for expressing what you need. I guess |
Okay, so the power outage set me back a bit, but it gave me a chance to think about how I'd like InitializationI think it's important that
This allows defining global owners in the global scope (e.g. at the root of the workspace), but keeps it out of any Output PathAdditionally, BuildingIn an ideal world, we'd be able to
This would parse all of the I think following the pattern of established tool integrations like Rule SemanticsI'm not quite at the point where users are owners of indivdual files, so most of the time, I find myself simply using this in my package BUILD files:
Playing around with it, I think the What are your thoughts? |
@zegl @alexeagle Can I get your thoughts on that 👆? I'm happy to create issues and do the work, but I'd rather we have some sort of a consensus on what the rule(s) should look like and how to use them. |
I agree with you that we should have a solution to all of these issues, and largely I agree with the solution that you have already suggested. Let's open new issues for all of these points, to make the discussion a bit more organized. 😃 Global ownersI agree that it would be nice to have a built in way to support this. Either through the Runnable rulesThe This might break someones workflow, but I think that it's for the greater good. We can still have the old MacroAs for the macro, do you think that it would be nice to host that macro in this repo, to make adoption easier? |
I think the need for the macro will be removed with additional changes to the library; namely, the I'll create issues tonight to further the discussion and isolate the work. |
Great, no macro needed then! :) |
I'd love to use this for Angular:
https://github.com/angular/angular/blob/master/.github/CODEOWNERS
which you can see DESPERATELY needs some help to scale
Here's a start:
angular/angular@master...alexeagle:codeowners
we can only make the switch when the new test passes, currently the delta is
https://gist.github.com/alexeagle/d6bf98f1c36923a77caa220edde00063
What we learn from this is:
@angular/framework-global-approvers
as a "global" approver and that should be expressible in the root of the tree, not repeated in each packageThe text was updated successfully, but these errors were encountered: