mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-30 03:22:14 +00:00
Revert "CI: fix build_report selection in case of job reuse"
This commit is contained in:
parent
9f242391b4
commit
26a6780324
@ -401,40 +401,30 @@ class BuildResult:
|
||||
@classmethod
|
||||
def load_any(cls, build_name: str, pr_number: int, head_ref: str): # type: ignore
|
||||
"""
|
||||
loads build report from one of all available report files (matching the job digest)
|
||||
with the following priority:
|
||||
1. report for the current PR @pr_number (might happen in PR' wf with or without job reuse)
|
||||
2. report for the current branch @head_ref (might happen in release/master' wf with or without job reuse)
|
||||
3. report for master branch (might happen in any workflow in case of job reuse)
|
||||
4. any other report (job reuse from another PR, if master report is not available yet)
|
||||
loads report from suitable report file with the following priority:
|
||||
1. report from PR with the same @pr_number
|
||||
2. report from branch with the same @head_ref
|
||||
3. report from the master
|
||||
4. any other report
|
||||
"""
|
||||
pr_report = None
|
||||
ref_report = None
|
||||
master_report = None
|
||||
any_report = None
|
||||
reports = []
|
||||
for file in Path(REPORT_PATH).iterdir():
|
||||
if f"{build_name}.json" in file.name:
|
||||
any_report = file
|
||||
if "_master_" in file.name:
|
||||
master_report = file
|
||||
elif f"_{head_ref}_" in file.name:
|
||||
ref_report = file
|
||||
elif pr_number and f"_{pr_number}_" in file.name:
|
||||
pr_report = file
|
||||
|
||||
if not any_report:
|
||||
reports.append(file)
|
||||
if not reports:
|
||||
return None
|
||||
|
||||
if pr_report:
|
||||
file_path = pr_report
|
||||
elif ref_report:
|
||||
file_path = ref_report
|
||||
elif master_report:
|
||||
file_path = master_report
|
||||
else:
|
||||
file_path = any_report
|
||||
|
||||
return cls.load_from_file(file_path)
|
||||
file_path = None
|
||||
for file in reports:
|
||||
if pr_number and f"_{pr_number}_" in file.name:
|
||||
file_path = file
|
||||
break
|
||||
if f"_{head_ref}_" in file.name:
|
||||
file_path = file
|
||||
break
|
||||
if "_master_" in file.name:
|
||||
file_path = file
|
||||
break
|
||||
return cls.load_from_file(file_path or reports[-1])
|
||||
|
||||
@classmethod
|
||||
def load_from_file(cls, file: Union[Path, str]): # type: ignore
|
||||
|
Loading…
Reference in New Issue
Block a user