Skip to content

tools: check_format verification that we add owners for new extensions#7265

Merged
mattklein123 merged 7 commits intoenvoyproxy:masterfrom
alyssawilk:owners
Jun 17, 2019
Merged

tools: check_format verification that we add owners for new extensions#7265
mattklein123 merged 7 commits intoenvoyproxy:masterfrom
alyssawilk:owners

Conversation

@alyssawilk
Copy link
Copy Markdown
Contributor

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

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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?

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Awesome. Small question about common folders.

/wait

"extensions/filters/http/common",
"extensions/filters/http/common/aws",
"extensions/filters/http/squash",
"extensions/filters/common",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we maybe filter out directories with common in it? These are things that are shared by other extensions which should have owners?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sure, no strong feelings on this if you think this is better.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, mild preference for this way, just for tooling.
Anything else you want to see here?

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Thanks, LGTM with a few small comment requests.

/wait


# 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:]:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you add a human description of what the regex does for those of us that are regex challenged?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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>
Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Thanks, makes sense, but I think maybe a few more comments and it's failing format.

/wait


# 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/';
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

semicolons? 😉

# 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):]:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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>
@mattklein123 mattklein123 merged commit 54e65f8 into envoyproxy:master Jun 17, 2019
@ipuustin
Copy link
Copy Markdown
Member

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):]:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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":

@alyssawilk
Copy link
Copy Markdown
Contributor Author

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

  1. adding the new directory into the known unowned directories
  2. changing the format script to allow new unowned directories
  3. tag the transport_sockets directory (and implicitly subdirectories) in CODEOWNERS

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

@ipuustin
Copy link
Copy Markdown
Member

@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 transport_sockets or transport_sockets/tls.

@PiotrSikora
Copy link
Copy Markdown
Contributor

I'd be inclined to add @PiotrSikora, and I'm checking with @envoyproxy/maintainers to see if anyone else is willing to claim ownership

Works for me, thanks! :) (I'm assuming you meant transport_sockets/tls and not transport_sockets category as a whole, since I believe each transport socket should be treated as a separate extension).

@alyssawilk
Copy link
Copy Markdown
Contributor Author

Absolutely. @ipuustin you can add @PiotrSikora and @lizan as owners of transport_sockets/tls which should take care of that and all subdirectories.

@ipuustin
Copy link
Copy Markdown
Member

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.

@alyssawilk alyssawilk deleted the owners branch July 31, 2019 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants