tools: check_format verification that we add owners for new extensions#7265
tools: check_format verification that we add owners for new extensions#7265mattklein123 merged 7 commits intoenvoyproxy:masterfrom
Conversation
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
tools/check_format.py
Outdated
There was a problem hiding this comment.
Also if there's any of these we want to flag with owners while we're in here, that'd be great.
For most of these I can think of one maintainer owner but not a backup. I could also relax our checks and allow a single owner?
mattklein123
left a comment
There was a problem hiding this comment.
Awesome. Small question about common folders.
/wait
| "extensions/filters/http/common", | ||
| "extensions/filters/http/common/aws", | ||
| "extensions/filters/http/squash", | ||
| "extensions/filters/common", |
There was a problem hiding this comment.
Can we maybe filter out directories with common in it? These are things that are shared by other extensions which should have owners?
There was a problem hiding this comment.
We totally could. I think it's a bit nicer to list them explicitly so if we do code reviewer assignment we have explicit owners. We could arguably script around it but I think it's easier to have it explicit. WDYT?
There was a problem hiding this comment.
Sure, no strong feelings on this if you think this is better.
There was a problem hiding this comment.
Yeah, mild preference for this way, just for tooling.
Anything else you want to see here?
mattklein123
left a comment
There was a problem hiding this comment.
Thanks, LGTM with a few small comment requests.
/wait
tools/check_format.py
Outdated
|
|
||
| # Sanity check CODEOWNERS. This doesn't need to be done in a multi-threaded | ||
| # manner as it is a small and limited list. | ||
| if dir_name.startswith('./source/extensions/') and '/' in dir_name[20:]: |
There was a problem hiding this comment.
Any way to make the 20 and 9 magic constants less magical either via some more descriptive code or some comments? It's not immediately clear to me what is going on here.
| try: | ||
| with open("./CODEOWNERS") as f: | ||
| for line in f: | ||
| m = re.search(r'..*(extensions[^@]* )@.*@.*', line) |
There was a problem hiding this comment.
Can you add a human description of what the regex does for those of us that are regex challenged?
There was a problem hiding this comment.
Done.
Note this does technically allow more than 2 owners (e.g. quic_listners) but does not allow 1 (reverse bridge filter) going forward.
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
mattklein123
left a comment
There was a problem hiding this comment.
Thanks, makes sense, but I think maybe a few more comments and it's failing format.
/wait
tools/check_format.py
Outdated
|
|
||
| # Sanity check CODEOWNERS. This doesn't need to be done in a multi-threaded | ||
| # manner as it is a small and limited list. | ||
| source_prefix = './source/'; |
| # manner as it is a small and limited list. | ||
| source_prefix = './source/'; | ||
| full_prefix = './source/extensions/'; | ||
| if dir_name.startswith(full_prefix) and '/' in dir_name[len(full_prefix):]: |
There was a problem hiding this comment.
sorry to come back to this but is the 2nd check just making sure it's a subdirectory? Can you add a small comment?
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
|
Hmm, this doesn't allow for arranging code in subdirectories inside extensions. I'm running in some trouble at #6326. Would the right solution be to have all files belonging to a single extension in one directory? |
| # Check to see if this directory is a subdir under /source/extensions | ||
| # Also ignore top level directories under /source/extensions since we don't | ||
| # need owners for source/extensions/access_loggers etc, just the subdirectories. | ||
| if dir_name.startswith(full_prefix) and '/' in dir_name[len(full_prefix):]: |
There was a problem hiding this comment.
I'm quite late to the review but it seems that this could become more readable and portable if you used os.path functions as done elsewhere in this file. Maybe something like:
if os.path.dirname(dir_name) == "./source/extensions":|
This does allow for subdirectories in general. The problem is you're creating new sub-directories in an unowned directory, which is seen as creating a new unowned directory. We can fix this one of three ways
I'd prefer not to do 2) because if someone adds something overly broad like "extensions/filters/network/" to make the script shut up, we'd basically lose the owners checks for that branch of extensions. 1) is probably easiest but I'd prefer 3) since it gets us more owners. I'd be inclined to add @PiotrSikora, and I'm checking with @envoyproxy/maintainers to see if anyone else is willing to claim ownership |
|
@alyssawilk Thanks! I'll go with 1) now to get the PR unblocked, but I can change the PR to 3) in case two maintainers volunteer to own |
Works for me, thanks! :) (I'm assuming you meant |
|
Absolutely. @ipuustin you can add @PiotrSikora and @lizan as owners of transport_sockets/tls which should take care of that and all subdirectories. |
|
Ok, I added a patch to PR #6326 to do that. If the patch is needed before that PR lands then just go ahead and use it in a separate PR. |
Risk Level: Low (tools only, but my python is pretty terrible =P)
Testing: manual testing that new additions fail check_format
Docs Changes: n/a
Release Notes: n/a