mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
commit
38527b6ba5
@ -1,7 +1,6 @@
|
||||
import os
|
||||
import logging
|
||||
|
||||
from typing import List, Tuple
|
||||
import ast
|
||||
|
||||
from env_helper import (
|
||||
GITHUB_JOB_URL,
|
||||
@ -10,15 +9,35 @@ from env_helper import (
|
||||
GITHUB_SERVER_URL,
|
||||
)
|
||||
from report import ReportColorTheme, create_test_html_report
|
||||
from s3_helper import S3Helper
|
||||
|
||||
|
||||
def process_logs(
|
||||
s3_client: S3Helper, additional_logs: List[str], s3_path_prefix: str
|
||||
) -> List[str]:
|
||||
s3_client, additional_logs, s3_path_prefix, test_results, with_raw_logs
|
||||
):
|
||||
logging.info("Upload files to s3 %s", additional_logs)
|
||||
|
||||
additional_urls = [] # type: List[str]
|
||||
processed_logs = {} # type: ignore
|
||||
# Firstly convert paths of logs from test_results to urls to s3.
|
||||
for test_result in test_results:
|
||||
if len(test_result) <= 3 or with_raw_logs:
|
||||
continue
|
||||
|
||||
# Convert from string repr of list to list.
|
||||
test_log_paths = ast.literal_eval(test_result[3])
|
||||
test_log_urls = []
|
||||
for log_path in test_log_paths:
|
||||
if log_path in processed_logs:
|
||||
test_log_urls.append(processed_logs[log_path])
|
||||
elif log_path:
|
||||
url = s3_client.upload_test_report_to_s3(
|
||||
log_path, s3_path_prefix + "/" + os.path.basename(log_path)
|
||||
)
|
||||
test_log_urls.append(url)
|
||||
processed_logs[log_path] = url
|
||||
|
||||
test_result[3] = test_log_urls
|
||||
|
||||
additional_urls = []
|
||||
for log_path in additional_logs:
|
||||
if log_path:
|
||||
additional_urls.append(
|
||||
@ -31,18 +50,21 @@ def process_logs(
|
||||
|
||||
|
||||
def upload_results(
|
||||
s3_client: S3Helper,
|
||||
pr_number: int,
|
||||
commit_sha: str,
|
||||
test_results: List[Tuple[str, str]],
|
||||
additional_files: List[str],
|
||||
check_name: str,
|
||||
with_raw_logs: bool = True,
|
||||
) -> str:
|
||||
s3_client,
|
||||
pr_number,
|
||||
commit_sha,
|
||||
test_results,
|
||||
additional_files,
|
||||
check_name,
|
||||
with_raw_logs=True,
|
||||
statuscolors=None,
|
||||
):
|
||||
s3_path_prefix = f"{pr_number}/{commit_sha}/" + check_name.lower().replace(
|
||||
" ", "_"
|
||||
).replace("(", "_").replace(")", "_").replace(",", "_")
|
||||
additional_urls = process_logs(s3_client, additional_files, s3_path_prefix)
|
||||
additional_urls = process_logs(
|
||||
s3_client, additional_files, s3_path_prefix, test_results, with_raw_logs
|
||||
)
|
||||
|
||||
branch_url = f"{GITHUB_SERVER_URL}/{GITHUB_REPOSITORY}/commits/master"
|
||||
branch_name = "master"
|
||||
|
Loading…
Reference in New Issue
Block a user