mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-30 19:42:00 +00:00
commit
38527b6ba5
@ -1,7 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
|
import ast
|
||||||
from typing import List, Tuple
|
|
||||||
|
|
||||||
from env_helper import (
|
from env_helper import (
|
||||||
GITHUB_JOB_URL,
|
GITHUB_JOB_URL,
|
||||||
@ -10,15 +9,35 @@ from env_helper import (
|
|||||||
GITHUB_SERVER_URL,
|
GITHUB_SERVER_URL,
|
||||||
)
|
)
|
||||||
from report import ReportColorTheme, create_test_html_report
|
from report import ReportColorTheme, create_test_html_report
|
||||||
from s3_helper import S3Helper
|
|
||||||
|
|
||||||
|
|
||||||
def process_logs(
|
def process_logs(
|
||||||
s3_client: S3Helper, additional_logs: List[str], s3_path_prefix: str
|
s3_client, additional_logs, s3_path_prefix, test_results, with_raw_logs
|
||||||
) -> List[str]:
|
):
|
||||||
logging.info("Upload files to s3 %s", additional_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:
|
for log_path in additional_logs:
|
||||||
if log_path:
|
if log_path:
|
||||||
additional_urls.append(
|
additional_urls.append(
|
||||||
@ -31,18 +50,21 @@ def process_logs(
|
|||||||
|
|
||||||
|
|
||||||
def upload_results(
|
def upload_results(
|
||||||
s3_client: S3Helper,
|
s3_client,
|
||||||
pr_number: int,
|
pr_number,
|
||||||
commit_sha: str,
|
commit_sha,
|
||||||
test_results: List[Tuple[str, str]],
|
test_results,
|
||||||
additional_files: List[str],
|
additional_files,
|
||||||
check_name: str,
|
check_name,
|
||||||
with_raw_logs: bool = True,
|
with_raw_logs=True,
|
||||||
) -> str:
|
statuscolors=None,
|
||||||
|
):
|
||||||
s3_path_prefix = f"{pr_number}/{commit_sha}/" + check_name.lower().replace(
|
s3_path_prefix = f"{pr_number}/{commit_sha}/" + check_name.lower().replace(
|
||||||
" ", "_"
|
" ", "_"
|
||||||
).replace("(", "_").replace(")", "_").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_url = f"{GITHUB_SERVER_URL}/{GITHUB_REPOSITORY}/commits/master"
|
||||||
branch_name = "master"
|
branch_name = "master"
|
||||||
|
Loading…
Reference in New Issue
Block a user