Diverge ci_config.CILabels from PRs Labels

This commit is contained in:
Mikhail f. Shiryaev 2024-04-24 17:28:48 +02:00
parent 76911c9fca
commit 784ca58a4b
No known key found for this signature in database
GPG Key ID: 4B02ED204C7D93F4
2 changed files with 23 additions and 21 deletions

View File

@ -17,7 +17,7 @@ from typing import Any, Dict, List, Optional, Sequence, Set, Tuple, Union
import docker_images_helper
import upload_result_helper
from build_check import get_release_or_pr
from ci_config import CI_CONFIG, Build, CIStages, JobNames, Labels
from ci_config import CI_CONFIG, Build, CILabels, CIStages, JobNames
from ci_utils import GHActions, is_hex, normalize_string
from clickhouse_helper import (
CiLogsCredentials,
@ -800,7 +800,7 @@ class CiOptions:
if not res.ci_jobs:
res.ci_jobs = []
res.ci_jobs.append(match.removeprefix("job_"))
elif match.startswith("ci_set_") and match in Labels:
elif match.startswith("ci_set_") and match in CILabels:
if not res.ci_sets:
res.ci_sets = []
res.ci_sets.append(match)
@ -816,12 +816,12 @@ class CiOptions:
res.exclude_keywords.append(
normalize_check_name(match.removeprefix("ci_exclude_"))
)
elif match == Labels.NO_CI_CACHE:
elif match == CILabels.NO_CI_CACHE:
res.no_ci_cache = True
print("NOTE: CI Cache will be disabled")
elif match == Labels.DO_NOT_TEST_LABEL:
elif match == CILabels.DO_NOT_TEST_LABEL:
res.do_not_test = True
elif match == Labels.NO_MERGE_COMMIT:
elif match == CILabels.NO_MERGE_COMMIT:
res.no_merge_commit = True
print("NOTE: Merge Commit will be disabled")
elif match.startswith("batch_"):
@ -920,7 +920,7 @@ class CiOptions:
# 3. Handle "do not test"
if self.do_not_test:
label_config = CI_CONFIG.get_label_config(Labels.DO_NOT_TEST_LABEL)
label_config = CI_CONFIG.get_label_config(CILabels.DO_NOT_TEST_LABEL)
assert label_config
print(
f"NOTE: CI 'do not test' setting applied, set jobs: [{label_config.run_jobs}]"
@ -1547,7 +1547,7 @@ def _fetch_commit_tokens(message: str, pr_info: PRInfo) -> List[str]:
res = [
match
for match in matches
if match in Labels or match.startswith("job_") or match.startswith("batch_")
if match in CILabels or match.startswith("job_") or match.startswith("batch_")
]
print(f"CI modifyers from commit message: [{res}]")
res_2 = []
@ -1556,7 +1556,9 @@ def _fetch_commit_tokens(message: str, pr_info: PRInfo) -> List[str]:
res_2 = [
match
for match in matches
if match in Labels or match.startswith("job_") or match.startswith("batch_")
if match in CILabels
or match.startswith("job_")
or match.startswith("batch_")
]
print(f"CI modifyers from PR body: [{res_2}]")
return list(set(res + res_2))

View File

@ -37,7 +37,7 @@ class Runners(metaclass=WithIter):
FUZZER_UNIT_TESTER = "fuzzer-unit-tester"
class Labels(metaclass=WithIter):
class CILabels(metaclass=WithIter):
"""
Label names or commit tokens in normalized form
"""
@ -282,7 +282,7 @@ builds_job_config = JobConfig(
run_command="build_check.py $BUILD_NAME",
)
fuzzer_build_job_config = deepcopy(builds_job_config)
fuzzer_build_job_config.run_by_label = Labels.libFuzzer
fuzzer_build_job_config.run_by_label = CILabels.libFuzzer
@dataclass
@ -825,28 +825,28 @@ class CIConfig:
CI_CONFIG = CIConfig(
label_configs={
Labels.DO_NOT_TEST_LABEL: LabelConfig(run_jobs=[JobNames.STYLE_CHECK]),
Labels.CI_SET_FAST: LabelConfig(
CILabels.DO_NOT_TEST_LABEL: LabelConfig(run_jobs=[JobNames.STYLE_CHECK]),
CILabels.CI_SET_FAST: LabelConfig(
run_jobs=[
JobNames.STYLE_CHECK,
JobNames.FAST_TEST,
]
),
Labels.CI_SET_ARM: LabelConfig(
CILabels.CI_SET_ARM: LabelConfig(
run_jobs=[
JobNames.STYLE_CHECK,
Build.PACKAGE_AARCH64,
JobNames.INTEGRATION_TEST_ARM,
]
),
Labels.CI_SET_INTEGRATION: LabelConfig(
CILabels.CI_SET_INTEGRATION: LabelConfig(
run_jobs=[
JobNames.STYLE_CHECK,
Build.PACKAGE_RELEASE,
JobNames.INTEGRATION_TEST,
]
),
Labels.CI_SET_ANALYZER: LabelConfig(
CILabels.CI_SET_ANALYZER: LabelConfig(
run_jobs=[
JobNames.STYLE_CHECK,
JobNames.FAST_TEST,
@ -856,7 +856,7 @@ CI_CONFIG = CIConfig(
JobNames.INTEGRATION_TEST_ASAN_ANALYZER,
]
),
Labels.CI_SET_STATLESS: LabelConfig(
CILabels.CI_SET_STATLESS: LabelConfig(
run_jobs=[
JobNames.STYLE_CHECK,
JobNames.FAST_TEST,
@ -864,7 +864,7 @@ CI_CONFIG = CIConfig(
JobNames.STATELESS_TEST_RELEASE,
]
),
Labels.CI_SET_STATLESS_ASAN: LabelConfig(
CILabels.CI_SET_STATLESS_ASAN: LabelConfig(
run_jobs=[
JobNames.STYLE_CHECK,
JobNames.FAST_TEST,
@ -872,7 +872,7 @@ CI_CONFIG = CIConfig(
JobNames.STATELESS_TEST_ASAN,
]
),
Labels.CI_SET_STATEFUL: LabelConfig(
CILabels.CI_SET_STATEFUL: LabelConfig(
run_jobs=[
JobNames.STYLE_CHECK,
JobNames.FAST_TEST,
@ -880,7 +880,7 @@ CI_CONFIG = CIConfig(
JobNames.STATEFUL_TEST_RELEASE,
]
),
Labels.CI_SET_STATEFUL_ASAN: LabelConfig(
CILabels.CI_SET_STATEFUL_ASAN: LabelConfig(
run_jobs=[
JobNames.STYLE_CHECK,
JobNames.FAST_TEST,
@ -888,7 +888,7 @@ CI_CONFIG = CIConfig(
JobNames.STATEFUL_TEST_ASAN,
]
),
Labels.CI_SET_REDUCED: LabelConfig(
CILabels.CI_SET_REDUCED: LabelConfig(
run_jobs=[
job
for job in JobNames
@ -1342,7 +1342,7 @@ CI_CONFIG = CIConfig(
JobNames.LIBFUZZER_TEST: TestConfig(
Build.FUZZERS,
job_config=JobConfig(
run_by_label=Labels.libFuzzer,
run_by_label=CILabels.libFuzzer,
timeout=10800,
run_command='libfuzzer_test_check.py "$CHECK_NAME" 10800',
),