mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 17:12:03 +00:00
Post status for test bugfix check
This commit is contained in:
parent
9f5dcd14af
commit
c18838715d
@ -7,10 +7,18 @@ import os
|
||||
import sys
|
||||
|
||||
|
||||
from github import Github
|
||||
|
||||
from s3_helper import S3Helper
|
||||
from get_robot_token import get_best_robot_token
|
||||
from pr_info import PRInfo
|
||||
from upload_result_helper import upload_results
|
||||
from commit_status_helper import post_commit_status
|
||||
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("report1")
|
||||
parser.add_argument("report2")
|
||||
parser.add_argument("status", nargs="+", help="Path to status file")
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
@ -27,19 +35,43 @@ def post_commit_status_from_file(file_path):
|
||||
|
||||
|
||||
def process_results(file_path):
|
||||
test_results = []
|
||||
state, report_url, description = post_commit_status_from_file(file_path)
|
||||
prefix = os.path.basename(os.path.dirname(file_path))
|
||||
print(
|
||||
f"::notice:: bugfix check: {prefix} - {state}: {description} Report url: {report_url}"
|
||||
)
|
||||
return state == "success"
|
||||
|
||||
test_results.append([f"{prefix}: {description}", state, report_url])
|
||||
return state == "success", test_results
|
||||
|
||||
|
||||
def main(args):
|
||||
is_ok = False
|
||||
is_ok = process_results(args.report1) or is_ok
|
||||
is_ok = process_results(args.report2) or is_ok
|
||||
sys.exit(0 if is_ok else 1)
|
||||
all_ok = False
|
||||
all_results = []
|
||||
for status_path in args.status:
|
||||
is_ok, test_results = process_results(status_path)
|
||||
all_ok = all_ok or is_ok
|
||||
all_results.extend(test_results)
|
||||
|
||||
check_name_with_group = "Bugfix validate check"
|
||||
|
||||
pr_info = PRInfo()
|
||||
report_url = upload_results(
|
||||
S3Helper(),
|
||||
pr_info.number,
|
||||
pr_info.sha,
|
||||
all_results,
|
||||
[],
|
||||
check_name_with_group,
|
||||
)
|
||||
|
||||
gh = Github(get_best_robot_token(), per_page=100)
|
||||
post_commit_status(
|
||||
gh,
|
||||
pr_info.sha,
|
||||
check_name_with_group,
|
||||
"",
|
||||
"success" if is_ok else "error",
|
||||
report_url,
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
@ -212,7 +212,9 @@ if __name__ == "__main__":
|
||||
gh = Github(get_best_robot_token(), per_page=100)
|
||||
|
||||
# For validate_bugix_check we need up to date information about labels, so pr_event_from_api is used
|
||||
pr_info = PRInfo(need_changed_files=run_changed_tests, pr_event_from_api=validate_bugix_check)
|
||||
pr_info = PRInfo(
|
||||
need_changed_files=run_changed_tests, pr_event_from_api=validate_bugix_check
|
||||
)
|
||||
|
||||
atexit.register(update_mergeable_check, gh, pr_info, check_name)
|
||||
|
||||
@ -322,7 +324,7 @@ if __name__ == "__main__":
|
||||
state, description, test_results, additional_logs = process_results(
|
||||
result_path, server_log_path
|
||||
)
|
||||
state = override_status(state, check_name, validate_bugix_check)
|
||||
state = override_status(state, check_name, invert=validate_bugix_check)
|
||||
|
||||
ch_helper = ClickHouseHelper()
|
||||
mark_flaky_tests(ch_helper, check_name, test_results)
|
||||
|
@ -169,7 +169,10 @@ if __name__ == "__main__":
|
||||
is_flaky_check = "flaky" in check_name
|
||||
|
||||
# For validate_bugix_check we need up to date information about labels, so pr_event_from_api is used
|
||||
pr_info = PRInfo(need_changed_files=is_flaky_check or validate_bugix_check, pr_event_from_api=validate_bugix_check)
|
||||
pr_info = PRInfo(
|
||||
need_changed_files=is_flaky_check or validate_bugix_check,
|
||||
pr_event_from_api=validate_bugix_check,
|
||||
)
|
||||
|
||||
if validate_bugix_check and "pr-bugfix" not in pr_info.labels:
|
||||
if args.post_commit_status == "file":
|
||||
@ -246,7 +249,7 @@ if __name__ == "__main__":
|
||||
subprocess.check_call(f"sudo chown -R ubuntu:ubuntu {temp_path}", shell=True)
|
||||
|
||||
state, description, test_results, additional_logs = process_results(result_path)
|
||||
state = override_status(state, check_name, validate_bugix_check)
|
||||
state = override_status(state, check_name, invert=validate_bugix_check)
|
||||
|
||||
ch_helper = ClickHouseHelper()
|
||||
mark_flaky_tests(ch_helper, check_name, test_results)
|
||||
|
Loading…
Reference in New Issue
Block a user