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

[tools] handle commits merged without PR in deprecated script #10723

Merged
merged 6 commits into from
Apr 23, 2020

Conversation

asraa
Copy link
Contributor

@asraa asraa commented Apr 9, 2020

Some commits (eg f5b0294 ) were added without a PR, so the script fails. Change so that issues can still be created.

This uses the commit message and sha instead of the PR title and number.

Testing:
I successfully got:
Flag envoy.reloadable_features.http1_flood_protection added at 2020-03-02 is not ready to remove
Instead of a crash. Tweaking the script to deprecate after 1 day and printing out the issue and title give me:

envoy.reloadable_features.http1_flood_protection deprecation
commit f5b0294f0a7c2d143f6d4d94afae9a0e6f9dacf7 (http: adding response flood protection) introduced a runtime guarded feature. This issue tracks source code cleanup.
  >> Assigning to alyssawilk

Signed-off-by: Asra Ali asraa@google.com

# In this case we cannot add a user login for an assignee.
change_title = commit.message.split('\n')[0] # Remove sign-off mesage
number = ('commit %s') % commit.hexsha
login = None
Copy link
Contributor Author

Choose a reason for hiding this comment

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

GitPython API can only give me author name and email, so I could not assign the issue to the NamedUser login like before. GitPython experts, is there a way?

Copy link
Contributor

Choose a reason for hiding this comment

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

Not that I know of. Does assigning to email work? Worst case we could assign the script runner to find an owner and print that's what is going on, but it'd be nice if we could do better.

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 found search_users functionality in the API -- I did guard against not finding the user, but I think (?) there's guarantee there will be a user with the email we find.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Edit: I trial ran it without creating the issue, I successfully got your login with the script now:

envoy.reloadable_features.http1_flood_protection deprecation
commit f5b0294f0a7c2d143f6d4d94afae9a0e6f9dacf7 (http: adding response flood protection) introduced a runtime guarded feature. This issue tracks source code cleanup.
  >> Assigning to alyssawilk

Signed-off-by: Asra Ali <asraa@google.com>
@alyssawilk alyssawilk self-assigned this Apr 13, 2020
@asraa
Copy link
Contributor Author

asraa commented Apr 13, 2020

Output when running currently:

Flag envoy.reloadable_features.http1_flood_protection added at 2020-03-02 is not ready to remove
Flag envoy.reloadable_features.strict_header_validation added at 2019-11-13 is not ready to remove
Flag envoy.reloadable_features.connection_header_sanitization added at 2019-11-18 is not ready to remove
Flag envoy.reloadable_features.strict_authority_validation added at 2019-12-10 is not ready to remove
Flag envoy.reloadable_features.reject_unsupported_transfer_encodings added at 2019-12-13 is not ready to remove
Flag envoy.reloadable_features.strict_method_validation added at 2020-01-09 is not ready to remove
Flag envoy.reloadable_features.new_http1_connection_pool_behavior added at 2020-01-29 is not ready to remove
Flag envoy.reloadable_features.new_http2_connection_pool_behavior added at 2020-01-29 is not ready to remove
Flag envoy.reloadable_features.ext_authz_http_service_enable_case_sensitive_string_matcher added at 2020-02-25 is not ready to remove
Found end sentinel

No code is deprecated.

If I change the script so I deprecate after 1 Day I get:

Flag envoy.reloadable_features.http1_flood_protection added at 2020-03-02 and is safe to remove
Flag envoy.reloadable_features.strict_header_validation added at 2019-11-13 and is safe to remove
Flag envoy.reloadable_features.connection_header_sanitization added at 2019-11-18 and is safe to remove
Flag envoy.reloadable_features.strict_authority_validation added at 2019-12-10 and is safe to remove
Flag envoy.reloadable_features.reject_unsupported_transfer_encodings added at 2019-12-13 and is safe to remove
Flag envoy.reloadable_features.strict_method_validation added at 2020-01-09 and is safe to remove
Flag envoy.reloadable_features.new_http1_connection_pool_behavior added at 2020-01-29 and is safe to remove
Flag envoy.reloadable_features.new_http2_connection_pool_behavior added at 2020-01-29 and is safe to remove
Flag envoy.reloadable_features.ext_authz_http_service_enable_case_sensitive_string_matcher added at 2020-02-25 and is safe to remove
Found end sentinel

envoy.reloadable_features.http1_flood_protection deprecation
commit f5b0294f0a7c2d143f6d4d94afae9a0e6f9dacf7 (http: adding response flood protection) introduced a runtime guarded feature. This issue tracks source code cleanup.
  >> Assigning to alyssar@chromium.org
  >> Issue already exists, not posting!
envoy.reloadable_features.strict_header_validation deprecation
#8849 (release: flipping flags) introduced a runtime guarded feature. This issue tracks source code cleanup.
  >> Assigning to alyssawilk
envoy.reloadable_features.connection_header_sanitization deprecation
#8862 (Sanitize headers nominated by the Connection header) introduced a runtime guarded feature. This issue tracks source code cleanup.
  >> Assigning to abaptiste
envoy.reloadable_features.strict_authority_validation deprecation
#77 (docs: small fix) introduced a runtime guarded feature. This issue tracks source code cleanup.
  >> Assigning to mattklein123
envoy.reloadable_features.reject_unsupported_transfer_encodings deprecation
#9316 (http: disallow unknown transfer encodings) introduced a runtime guarded feature. This issue tracks source code cleanup.
  >> Assigning to alyssawilk
envoy.reloadable_features.strict_method_validation deprecation
#9637 (http: explicitly blocking CONNECT for HTTP/1.1) introduced a runtime guarded feature. This issue tracks source code cleanup.
  >> Assigning to alyssawilk
envoy.reloadable_features.new_http1_connection_pool_behavior deprecation
#9668 (Combine H1 and H2 conn_pool implementations) introduced a runtime guarded feature. This issue tracks source code cleanup.
  >> Assigning to ggreenway
envoy.reloadable_features.new_http2_connection_pool_behavior deprecation
#9668 (Combine H1 and H2 conn_pool implementations) introduced a runtime guarded feature. This issue tracks source code cleanup.
  >> Assigning to ggreenway
envoy.reloadable_features.ext_authz_http_service_enable_case_sensitive_string_matcher deprecation
#9715 (ext_authz: Deprecate LowerCaseStringMatcher) introduced a runtime guarded feature. This issue tracks source code cleanup.
  >> Assigning to dio

Copy link
Contributor

@alyssawilk alyssawilk left a comment

Choose a reason for hiding this comment

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

Cool, thanks for the fixes - I thought we'd had setec flags before - I wonder if the way we imported them changed?

number = ('#%d') % pr
login = pr_info.user.login
else:
# Extract Commit message, sha, and author.
Copy link
Contributor

Choose a reason for hiding this comment

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

Commit - commit

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

else:
# Extract Commit message, sha, and author.
# In this case we cannot add a user login for an assignee.
change_title = commit.message.split('\n')[0] # Remove sign-off mesage
Copy link
Contributor

Choose a reason for hiding this comment

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

It's not sign off but description too (if there is one) yes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep -- that's right it.

# In this case we cannot add a user login for an assignee.
change_title = commit.message.split('\n')[0] # Remove sign-off mesage
number = ('commit %s') % commit.hexsha
login = None
Copy link
Contributor

Choose a reason for hiding this comment

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

Not that I know of. Does assigning to email work? Worst case we could assign the script runner to find an owner and print that's what is going on, but it'd be nice if we could do better.

Signed-off-by: Asra Ali <asraa@google.com>
Signed-off-by: Asra Ali <asraa@google.com>
alyssawilk
alyssawilk previously approved these changes Apr 13, 2020
Copy link
Contributor

@alyssawilk alyssawilk left a comment

Choose a reason for hiding this comment

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

Cool, thanks for being the non-alyssar runner of our release scripts, and fixing the holes! LGTM from "this says it is doing what I think it should be doing" perspective but as far as I'm concerned I do not have python readability so mind getting a pass from someone who does? @junr03 maybe?

@mattklein123
Copy link
Member

Please merge master. Also @junr03 PTAL. Thank you!

/wait

Copy link
Member

@junr03 junr03 left a comment

Choose a reason for hiding this comment

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

Some suggestions. I think @alyssawilk is being generous re: my python readability :).

tools/deprecate_version/deprecate_version.py Show resolved Hide resolved
else:
# Extract commit message, sha, and author.
# In this case we cannot add a user login for an assignee.
change_title = commit.message.split('\n')[0] # Remove description.
Copy link
Member

Choose a reason for hiding this comment

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

should we constrain the length of this message a little bit beyond the newline char? I feel like people could be more verbose here than in a PR title.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh maybe, it looks like there's no enforced limit on the commit title. People seem to recommend 50/72 stylistically? I arbitrarily put 50.

print(title)
print(body)
print(' >> Assigning to %s' % pr_info.user.login)
print(' >> Assigning to %s' % (login if login else email))
Copy link
Member

Choose a reason for hiding this comment

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

I think you can used shorthand ternary here:

Suggested change
print(' >> Assigning to %s' % (login if login else email))
print(' >> Assigning to %s' % (login or email))

Not sure which one is preferred by python people these days

Signed-off-by: Asra Ali <asraa@google.com>
Copy link
Member

@junr03 junr03 left a comment

Choose a reason for hiding this comment

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

lgtm!

@asraa asraa merged commit 528287d into envoyproxy:master Apr 23, 2020
spenceral added a commit to spenceral/envoy that referenced this pull request Apr 23, 2020
Signed-off-by: Spencer Lewis <slewis@squareup.com>
* master: (46 commits)
  allow specifying the API version of bootstrap from the command line (envoyproxy#10803)
  config: adding connect matcher (unused) (envoyproxy#10894)
  Add missing dependency on `assert.h` (envoyproxy#10918)
  Lower heap and disk space used by kafka tests (envoyproxy#10915)
  [tools] handle commits merged without PR in deprecated script (envoyproxy#10723)
  tools: including working tree in modified_since_last_github_commit.sh diff. (envoyproxy#10911)
  rocketmq_proxy: implement rocketmq proxy
  [docs] PR template to include commit message (envoyproxy#10900)
  docs: breaking long word to stop content overflow. (envoyproxy#10880)
  Delete legacy connection pool code. (envoyproxy#10881)
  wasm: clarify how configuration is passed (envoyproxy#10782)
  issue template: clarify security/crash reporting (envoyproxy#10885)
  api/faq: add entry on incremental xDS. (envoyproxy#10876)
  router: retry overloaded requests (envoyproxy#10847)
  Remove inclusion of pthread.h, not needed for linux compilation (envoyproxy#10895)
  request_id: Add option to always set request id in response (envoyproxy#10808)
  xray: Use correct types for segment document output (envoyproxy#10834)
  router: fixing a watermark bug for streaming retries (envoyproxy#10866)
  http: auditing Path() calls for safety with Pathless CONNECT (envoyproxy#10851)
  Remove hardcoded type urls Part.2 (envoyproxy#10848)
  ...
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