-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
require extra review for breaking change messages #31361
Changes from 1 commit
f53237b
10aa3a7
120279f
22cdffd
dabc536
3478fec
60973c3
96e5455
6e77eb1
e5aff3f
217ac9e
000ef28
f15e60c
c07666d
c95b2ae
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. moved all required reviewer-related stuff here since it was no longer just for acceptance test config |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# | ||
# Copyright (c) 2023 Airbyte, Inc., all rights reserved. | ||
# | ||
|
||
from typing import Dict, List, Set, Union | ||
|
||
import yaml | ||
from connector_ops import utils | ||
|
||
BACKWARD_COMPATIBILITY_REVIEWERS = {"connector-operations", "connector-extensibility"} | ||
TEST_STRICTNESS_LEVEL_REVIEWERS = {"connector-operations"} | ||
GA_BYPASS_REASON_REVIEWERS = {"connector-operations"} | ||
GA_CONNECTOR_REVIEWERS = {"gl-python"} | ||
BREAKING_CHANGE_REVIEWERS = {"breaking-change-reviewers"} | ||
REVIEW_REQUIREMENTS_FILE_PATH = ".github/connector_org_review_requirements.yaml" | ||
|
||
|
||
def find_changed_important_connectors() -> Set[utils.Connector]: | ||
"""Find important connectors modified on the current branch. | ||
|
||
Returns: | ||
Set[utils.Connector]: The set of GA connectors that were modified on the current branch. | ||
""" | ||
changed_connectors = utils.get_changed_connectors(destination=False, third_party=False) | ||
return {connector for connector in changed_connectors if connector.is_important_connector} | ||
|
||
|
||
def get_bypass_reason_changes() -> Set[utils.Connector]: | ||
"""Find connectors that have modified bypass_reasons. | ||
|
||
Returns: | ||
Set[str]: Set of connector names e.g {"source-github"}: The set of GA connectors that have changed bypass_reasons. | ||
""" | ||
bypass_reason_changes = utils.get_changed_acceptance_test_config(diff_regex="bypass_reason") | ||
return bypass_reason_changes.intersection(find_changed_important_connectors()) | ||
|
||
|
||
def find_mandatory_reviewers() -> List[Dict[str, Union[str, Dict[str, List]]]]: | ||
important_connector_changes = find_changed_important_connectors() | ||
backward_compatibility_changes = utils.get_changed_acceptance_test_config(diff_regex="disable_for_version") | ||
test_strictness_level_changes = utils.get_changed_acceptance_test_config(diff_regex="test_strictness_level") | ||
ga_bypass_reason_changes = get_bypass_reason_changes() | ||
breaking_change_changes = utils.get_changed_metadata(diff_regex="upgradeDeadline") | ||
|
||
required_reviewers = [] | ||
|
||
if backward_compatibility_changes: | ||
required_reviewers.append({"name": "Backwards Compatibility Test Skip", "teams": list(BACKWARD_COMPATIBILITY_REVIEWERS)}) | ||
if test_strictness_level_changes: | ||
required_reviewers.append({"name": "Acceptance Test Strictness Level", "teams": list(TEST_STRICTNESS_LEVEL_REVIEWERS)}) | ||
if ga_bypass_reason_changes: | ||
required_reviewers.append({"name": "GA Acceptance Test Bypass", "teams": list(GA_BYPASS_REASON_REVIEWERS)}) | ||
if important_connector_changes: | ||
required_reviewers.append({"name": "GA Connectors", "teams": list(GA_CONNECTOR_REVIEWERS)}) | ||
if breaking_change_changes: | ||
required_reviewers.append({"name": "Breaking Changes", "teams": list(BREAKING_CHANGE_REVIEWERS)}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a mapping between change detection function and mandatory reviewers can be more readable |
||
|
||
return required_reviewers | ||
|
||
|
||
def write_review_requirements_file(): | ||
mandatory_reviewers = find_mandatory_reviewers() | ||
|
||
if mandatory_reviewers: | ||
requirements_file_content = [dict(r, paths="unmatched") for r in mandatory_reviewers] | ||
with open(REVIEW_REQUIREMENTS_FILE_PATH, "w") as requirements_file: | ||
yaml.safe_dump(requirements_file_content, requirements_file) | ||
print("CREATED_REQUIREMENTS_FILE=true") | ||
else: | ||
print("CREATED_REQUIREMENTS_FILE=false") | ||
|
||
|
||
def print_mandatory_reviewers(): | ||
teams = set() | ||
mandatory_reviewers = find_mandatory_reviewers() | ||
for reviewers in mandatory_reviewers: | ||
teams.update(reviewers["teams"]) | ||
print(f"MANDATORY_REVIEWERS=A review is required from these teams: {', '.join(teams)}") |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,7 @@ freezegun = "^1.1.0" | |
|
||
[tool.poetry.scripts] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please bump the package version 🙏 |
||
check-test-strictness-level = "connector_ops.acceptance_test_config_checks:check_test_strictness_level" | ||
write-review-requirements-file = "connector_ops.acceptance_test_config_checks:write_review_requirements_file" | ||
print-mandatory-reviewers = "connector_ops.acceptance_test_config_checks:print_mandatory_reviewers" | ||
write-review-requirements-file = "connector_ops.required_reviewer_checks:write_review_requirements_file" | ||
print-mandatory-reviewers = "connector_ops.required_reviewer_checks:print_mandatory_reviewers" | ||
allowed-hosts-checks = "connector_ops.allowed_hosts_checks:check_allowed_hosts" | ||
run-qa-checks = "connector_ops.qa_checks:run_qa_checks" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for moving it to a separate module!