mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'ci/respect_build_only_label_while_generating_test_jobs' into 'master'
ci: support build only label again in dynamic pipeline See merge request espressif/esp-idf!28434
This commit is contained in:
commit
7be04869d2
@ -29,3 +29,5 @@ TEST_RELATED_APPS_DOWNLOAD_URLS_FILENAME = 'test_related_apps_download_urls.yml'
|
||||
REPORT_TEMPLATE_FILEPATH = os.path.join(
|
||||
IDF_PATH, 'tools', 'ci', 'dynamic_pipelines', 'templates', 'report.template.html'
|
||||
)
|
||||
|
||||
BUILD_ONLY_LABEL = 'For Maintainers: Only Build Tests'
|
||||
|
@ -71,6 +71,7 @@ class ReportGenerator:
|
||||
Full {self.title} here: {url}/-/jobs/{job_id}/artifacts/{self.output_filepath} (with commit {commit_id})
|
||||
|
||||
'''
|
||||
print(comment)
|
||||
|
||||
if self.mr is None:
|
||||
print('No MR found, skip posting comment')
|
||||
|
@ -100,6 +100,9 @@ def main(arguments: argparse.Namespace) -> None:
|
||||
)
|
||||
build_jobs.append(non_test_apps_build_job)
|
||||
|
||||
if mr_labels := os.getenv('CI_MERGE_REQUEST_LABELS'):
|
||||
print(f'MR labels: {mr_labels}')
|
||||
|
||||
# check if there's no jobs
|
||||
if not build_jobs:
|
||||
print('No apps need to be built. Create one empty job instead')
|
||||
|
@ -15,8 +15,8 @@ import typing as t
|
||||
from collections import Counter, defaultdict
|
||||
|
||||
import __init__ # noqa: F401 # inject the system path
|
||||
from dynamic_pipelines.constants import (DEFAULT_CASES_TEST_PER_JOB, DEFAULT_TARGET_TEST_CHILD_PIPELINE_FILEPATH,
|
||||
DEFAULT_TEST_PATHS)
|
||||
from dynamic_pipelines.constants import (BUILD_ONLY_LABEL, DEFAULT_CASES_TEST_PER_JOB,
|
||||
DEFAULT_TARGET_TEST_CHILD_PIPELINE_FILEPATH, DEFAULT_TEST_PATHS)
|
||||
from dynamic_pipelines.models import EmptyJob, Job, TargetTestJob
|
||||
from dynamic_pipelines.utils import dump_jobs_to_yaml
|
||||
from gitlab.v4.objects import Project
|
||||
@ -41,7 +41,17 @@ def get_tags_with_amount(s: str) -> t.List[str]:
|
||||
return sorted(res)
|
||||
|
||||
|
||||
def generate_target_test_child_pipeline(project: Project, paths: str, apps: t.List[App], output_filepath: str) -> None:
|
||||
def get_target_test_jobs(project: Project, paths: str, apps: t.List[App]) -> t.Tuple[t.List[Job], t.List[str]]:
|
||||
"""
|
||||
Return the target test jobs and the extra yaml files to include
|
||||
"""
|
||||
if mr_labels := os.getenv('CI_MERGE_REQUEST_LABELS'):
|
||||
print(f'MR labels: {mr_labels}')
|
||||
|
||||
if BUILD_ONLY_LABEL in mr_labels.split(','):
|
||||
print('MR has build only label, skip generating target test child pipeline')
|
||||
return [EmptyJob()], []
|
||||
|
||||
pytest_cases = get_pytest_cases(
|
||||
paths,
|
||||
apps=apps,
|
||||
@ -78,13 +88,18 @@ def generate_target_test_child_pipeline(project: Project, paths: str, apps: t.Li
|
||||
|
||||
target_test_jobs.append(target_test_job)
|
||||
|
||||
extra_include_yml: t.List[str] = []
|
||||
if not target_test_jobs:
|
||||
print('No target test cases required, create one empty job instead')
|
||||
target_test_jobs.append(EmptyJob())
|
||||
extra_include_yml = []
|
||||
else:
|
||||
extra_include_yml = ['tools/ci/dynamic_pipelines/templates/generate_target_test_report.yml']
|
||||
|
||||
return target_test_jobs, extra_include_yml
|
||||
|
||||
|
||||
def generate_target_test_child_pipeline(project: Project, paths: str, apps: t.List[App], output_filepath: str) -> None:
|
||||
target_test_jobs, extra_include_yml = get_target_test_jobs(project, paths, apps)
|
||||
dump_jobs_to_yaml(target_test_jobs, output_filepath, extra_include_yml)
|
||||
print(f'Generate child pipeline yaml file {output_filepath} with {sum(j.parallel for j in target_test_jobs)} jobs')
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user