mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 17:12:03 +00:00
Support "do not test" label with ci.py (#58128)
* support "do not test" label with ci.py Co-authored-by: robot-clickhouse <robot-clickhouse@users.noreply.github.com>
This commit is contained in:
parent
e2c1230b00
commit
8ac13b3e26
@ -397,6 +397,21 @@ def _configure_jobs(
|
||||
else:
|
||||
jobs_to_skip += (job,)
|
||||
|
||||
if pr_labels:
|
||||
jobs_requested_by_label = [] # type: List[str]
|
||||
ci_controlling_labels = [] # type: List[str]
|
||||
for label in pr_labels:
|
||||
label_config = CI_CONFIG.get_label_config(label)
|
||||
if label_config:
|
||||
jobs_requested_by_label += label_config.run_jobs
|
||||
ci_controlling_labels += [label]
|
||||
if ci_controlling_labels:
|
||||
print(f"NOTE: CI controlling labels are set: [{ci_controlling_labels}]")
|
||||
print(
|
||||
f" : following jobs will be executed: [{jobs_requested_by_label}]"
|
||||
)
|
||||
jobs_to_do = jobs_requested_by_label
|
||||
|
||||
if commit_tokens:
|
||||
requested_jobs = [
|
||||
token[len("#job_") :]
|
||||
@ -416,7 +431,7 @@ def _configure_jobs(
|
||||
if parent in jobs_to_do and parent not in jobs_to_do_requested:
|
||||
jobs_to_do_requested.append(parent)
|
||||
print(
|
||||
f"NOTE: Only specific job(s) were requested: [{jobs_to_do_requested}]"
|
||||
f"NOTE: Only specific job(s) were requested by commit message tokens: [{jobs_to_do_requested}]"
|
||||
)
|
||||
jobs_to_do = jobs_to_do_requested
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from enum import Enum
|
||||
import logging
|
||||
|
||||
from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser
|
||||
@ -8,6 +9,10 @@ from pathlib import Path
|
||||
from typing import Callable, Dict, Iterable, List, Literal, Optional, Union
|
||||
|
||||
|
||||
class Labels(Enum):
|
||||
DO_NOT_TEST_LABEL = "do not test"
|
||||
|
||||
|
||||
@dataclass
|
||||
class DigestConfig:
|
||||
# all files, dirs to include into digest, glob supported
|
||||
@ -22,6 +27,15 @@ class DigestConfig:
|
||||
git_submodules: bool = False
|
||||
|
||||
|
||||
@dataclass
|
||||
class LabelConfig:
|
||||
"""
|
||||
class to configure different CI scenarious per GH label
|
||||
"""
|
||||
|
||||
run_jobs: Iterable[str] = frozenset()
|
||||
|
||||
|
||||
@dataclass
|
||||
class JobConfig:
|
||||
"""
|
||||
@ -95,7 +109,7 @@ class TestConfig:
|
||||
BuildConfigs = Dict[str, BuildConfig]
|
||||
BuildsReportConfig = Dict[str, BuildReportConfig]
|
||||
TestConfigs = Dict[str, TestConfig]
|
||||
|
||||
LabelConfigs = Dict[str, LabelConfig]
|
||||
|
||||
# common digests configs
|
||||
compatibility_check_digest = DigestConfig(
|
||||
@ -268,6 +282,13 @@ class CiConfig:
|
||||
builds_report_config: BuildsReportConfig
|
||||
test_configs: TestConfigs
|
||||
other_jobs_configs: TestConfigs
|
||||
label_configs: LabelConfigs
|
||||
|
||||
def get_label_config(self, label_name: str) -> Optional[LabelConfig]:
|
||||
for label, config in self.label_configs.items():
|
||||
if label_name == label:
|
||||
return config
|
||||
return None
|
||||
|
||||
def get_job_config(self, check_name: str) -> JobConfig:
|
||||
res = None
|
||||
@ -417,6 +438,9 @@ class CiConfig:
|
||||
|
||||
|
||||
CI_CONFIG = CiConfig(
|
||||
label_configs={
|
||||
Labels.DO_NOT_TEST_LABEL.value: LabelConfig(run_jobs=["Style check"]),
|
||||
},
|
||||
build_config={
|
||||
"package_release": BuildConfig(
|
||||
name="package_release",
|
||||
|
@ -32,7 +32,6 @@ TRUSTED_ORG_IDS = {
|
||||
|
||||
OK_SKIP_LABELS = {"release", "pr-backport", "pr-cherrypick"}
|
||||
CAN_BE_TESTED_LABEL = "can be tested"
|
||||
DO_NOT_TEST_LABEL = "do not test"
|
||||
FEATURE_LABEL = "pr-feature"
|
||||
SUBMODULE_CHANGED_LABEL = "submodule changed"
|
||||
PR_CHECK = "PR Check"
|
||||
@ -68,10 +67,6 @@ def should_run_ci_for_pr(pr_info: PRInfo) -> Tuple[bool, str]:
|
||||
print(f"Label '{FORCE_TESTS_LABEL}' set, forcing remaining checks")
|
||||
return True, f"Labeled '{FORCE_TESTS_LABEL}'"
|
||||
|
||||
if DO_NOT_TEST_LABEL in pr_info.labels:
|
||||
print(f"Label '{DO_NOT_TEST_LABEL}' set, skipping remaining checks")
|
||||
return False, f"Labeled '{DO_NOT_TEST_LABEL}'"
|
||||
|
||||
if OK_SKIP_LABELS.intersection(pr_info.labels):
|
||||
return True, "Don't try new checks for release/backports/cherry-picks"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user