Skip to content

Commit

Permalink
Include Selective Check to Ping Maintainer about Legacy WWW and API C…
Browse files Browse the repository at this point in the history
…hanges (apache#42758)

* Include new check in selective_checks.py for checking PR labels to ping maintainers about updating legacy ui or legacy api code piece

* Remove airflow/api from LEGACY_API_FILES
  • Loading branch information
bugraoz93 authored Oct 5, 2024
1 parent 2ffc389 commit 1479cf6
Showing 1 changed file with 41 additions and 4 deletions.
45 changes: 41 additions & 4 deletions dev/breeze/src/airflow_breeze/utils/selective_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@
FULL_TESTS_NEEDED_LABEL = "full tests needed"
INCLUDE_SUCCESS_OUTPUTS_LABEL = "include success outputs"
LATEST_VERSIONS_ONLY_LABEL = "latest versions only"
LEGACY_UI_LABEL = "legacy ui"
LEGACY_API_LABEL = "legacy api"
NON_COMMITTER_BUILD_LABEL = "non committer build"
UPGRADE_TO_NEWER_DEPENDENCIES_LABEL = "upgrade to newer dependencies"
USE_PUBLIC_RUNNERS_LABEL = "use public runners"
Expand All @@ -102,11 +104,12 @@ class FileGroupForCi(Enum):
ALWAYS_TESTS_FILES = "always_test_files"
API_TEST_FILES = "api_test_files"
API_CODEGEN_FILES = "api_codegen_files"
LEGACY_API_FILES = "legacy_api_files"
HELM_FILES = "helm_files"
DEPENDENCY_FILES = "dependency_files"
DOC_FILES = "doc_files"
UI_FILES = "ui_files"
WWW_FILES = "www_files"
LEGACY_WWW_FILES = "legacy_www_files"
SYSTEM_TEST_FILES = "system_tests"
KUBERNETES_FILES = "kubernetes_files"
ALL_PYTHON_FILES = "all_python_files"
Expand Down Expand Up @@ -157,6 +160,9 @@ def __hash__(self):
r"^airflow/api_connexion/openapi/v1\.yaml",
r"^clients/gen",
],
FileGroupForCi.LEGACY_API_FILES: [
r"^airflow/api_connexion/",
],
FileGroupForCi.HELM_FILES: [
r"^chart",
r"^airflow/kubernetes",
Expand Down Expand Up @@ -185,7 +191,7 @@ def __hash__(self):
r"^airflow/ui/[^/]+\.json$",
r"^airflow/ui/.*\.lock$",
],
FileGroupForCi.WWW_FILES: [
FileGroupForCi.LEGACY_WWW_FILES: [
r"^airflow/www/.*\.ts[x]?$",
r"^airflow/www/.*\.js[x]?$",
r"^airflow/www/[^/]+\.json$",
Expand Down Expand Up @@ -680,7 +686,7 @@ def run_ui_tests(self) -> bool:

@cached_property
def run_www_tests(self) -> bool:
return self._should_be_run(FileGroupForCi.WWW_FILES)
return self._should_be_run(FileGroupForCi.LEGACY_WWW_FILES)

@cached_property
def run_amazon_tests(self) -> bool:
Expand Down Expand Up @@ -1055,7 +1061,9 @@ def skip_pre_commits(self) -> str:
# when full tests are needed, we do not want to skip any checks and we should
# run all the pre-commits just to be sure everything is ok when some structural changes occurred
return ",".join(sorted(pre_commits_to_skip))
if not self._matching_files(FileGroupForCi.WWW_FILES, CI_FILE_GROUP_MATCHES, CI_FILE_GROUP_EXCLUDES):
if not self._matching_files(
FileGroupForCi.LEGACY_WWW_FILES, CI_FILE_GROUP_MATCHES, CI_FILE_GROUP_EXCLUDES
):
pre_commits_to_skip.add("ts-compile-format-lint-www")
if not self._matching_files(FileGroupForCi.UI_FILES, CI_FILE_GROUP_MATCHES, CI_FILE_GROUP_EXCLUDES):
pre_commits_to_skip.add("ts-compile-format-lint-ui")
Expand Down Expand Up @@ -1354,3 +1362,32 @@ def _is_canary_run(self):
self._github_event in [GithubEvents.SCHEDULE, GithubEvents.PUSH]
and self._github_repository == APACHE_AIRFLOW_GITHUB_REPOSITORY
) or CANARY_LABEL in self._pr_labels

@cached_property
def is_legacy_ui_api_labeled(self) -> bool:
# Selective check for legacy UI/API updates.
# It is to ping the maintainer to add the label and make them aware of the changes.
if (
self._matching_files(
FileGroupForCi.LEGACY_API_FILES, CI_FILE_GROUP_MATCHES, CI_FILE_GROUP_EXCLUDES
)
and LEGACY_API_LABEL not in self._pr_labels
):
get_console().print(
f"[error]Please ask maintainer to assign "
f"the '{LEGACY_API_LABEL}' label to the PR in order to continue"
)
sys.exit(1)
elif (
self._matching_files(
FileGroupForCi.LEGACY_WWW_FILES, CI_FILE_GROUP_MATCHES, CI_FILE_GROUP_EXCLUDES
)
and LEGACY_UI_LABEL not in self._pr_labels
):
get_console().print(
f"[error]Please ask maintainer to assign "
f"the '{LEGACY_UI_LABEL}' label to the PR in order to continue"
)
sys.exit(1)
else:
return True

0 comments on commit 1479cf6

Please sign in to comment.