-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
require extra review for breaking change messages (#31361)
<!-- Thanks for your contribution! Before you submit the pull request, I'd like to kindly remind you to take a moment and read through our guidelines to ensure that your contribution aligns with the type of contributions our project accepts. All the information you need can be found here: https://docs.airbyte.com/contributing-to-airbyte/ We truly appreciate your interest in contributing to Airbyte, and we're excited to see what you have to offer! If you have any questions or need any assistance, feel free to reach out in #contributions Slack channel. --> ## What We want to add Kat as a required reviewer when breaking change releases are made. This adds some logic to our existing checks to do so. This also sets `request-reviewers: true` on our action so reviews are automatically requested when required. Close #31141 ## How - Created new group, `breaking-change-reviewers` of which Kat is the only member currently to make a bit more flexible if we do want to change who gets notified or add more people. - Refactor mandatory reviewer logic to support multiple required review groups at a time, rather than just requesting the first group. - Add a method to get diff from connector metadata, + refactor the current method to get acceptance test config changes to use a common method. - Since it's not just acceptance test config changes that cause required reviewers, also moved out some code from `acceptance_test_config_checks` to `required-reviewer_checks`
- Loading branch information
1 parent
8e1fea4
commit c207a7f
Showing
6 changed files
with
143 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
airbyte-ci/connectors/connector_ops/connector_ops/required_reviewer_checks.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# | ||
# 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]]]]: | ||
requirements = [ | ||
{ | ||
"name": "Backwards Compatibility Test Skip", | ||
"teams": list(BACKWARD_COMPATIBILITY_REVIEWERS), | ||
"is_required": utils.get_changed_acceptance_test_config(diff_regex="disable_for_version"), | ||
}, | ||
{ | ||
"name": "Acceptance Test Strictness Level", | ||
"teams": list(TEST_STRICTNESS_LEVEL_REVIEWERS), | ||
"is_required": utils.get_changed_acceptance_test_config(diff_regex="test_strictness_level"), | ||
}, | ||
{"name": "GA Acceptance Test Bypass", "teams": list(GA_BYPASS_REASON_REVIEWERS), "is_required": get_bypass_reason_changes()}, | ||
{"name": "GA Connectors", "teams": list(GA_CONNECTOR_REVIEWERS), "is_required": find_changed_important_connectors()}, | ||
{ | ||
"name": "Breaking Changes", | ||
"teams": list(BREAKING_CHANGE_REVIEWERS), | ||
"is_required": utils.get_changed_metadata(diff_regex="upgradeDeadline"), | ||
}, | ||
] | ||
|
||
return [{"name": r["name"], "teams": r["teams"]} for r in requirements if r["is_required"]] | ||
|
||
|
||
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)}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api" | |
|
||
[tool.poetry] | ||
name = "connector_ops" | ||
version = "0.2.6" | ||
version = "0.3.0" | ||
description = "Packaged maintained by the connector operations team to perform CI for connectors" | ||
authors = ["Airbyte <[email protected]>"] | ||
|
||
|
@@ -30,7 +30,7 @@ freezegun = "^1.1.0" | |
|
||
[tool.poetry.scripts] | ||
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters