mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 07:31:57 +00:00
Merge pull request #39307 from ClickHouse/ci-simple-check-fix-rerun
Simple Check should be updated on rerun
This commit is contained in:
commit
c24800c7d5
@ -3,8 +3,9 @@
|
||||
import time
|
||||
import os
|
||||
import csv
|
||||
from env_helper import GITHUB_REPOSITORY
|
||||
from env_helper import GITHUB_REPOSITORY, GITHUB_RUN_URL
|
||||
from ci_config import CI_CONFIG
|
||||
from pr_info import SKIP_SIMPLE_CHECK_LABEL
|
||||
|
||||
RETRY = 5
|
||||
|
||||
@ -73,3 +74,28 @@ def post_labels(gh, pr_info, labels_names):
|
||||
pull_request = repo.get_pull(pr_info.number)
|
||||
for label in labels_names:
|
||||
pull_request.add_to_labels(label)
|
||||
|
||||
|
||||
def fail_simple_check(gh, pr_info, description):
|
||||
if SKIP_SIMPLE_CHECK_LABEL in pr_info.labels:
|
||||
return
|
||||
commit = get_commit(gh, pr_info.sha)
|
||||
commit.create_status(
|
||||
context="Simple Check",
|
||||
description=description,
|
||||
state="failure",
|
||||
target_url=GITHUB_RUN_URL,
|
||||
)
|
||||
|
||||
|
||||
def create_simple_check(gh, pr_info):
|
||||
commit = get_commit(gh, pr_info.sha)
|
||||
for status in commit.get_statuses():
|
||||
if "Simple Check" in status.context:
|
||||
return
|
||||
commit.create_status(
|
||||
context="Simple Check",
|
||||
description="Skipped",
|
||||
state="success",
|
||||
target_url=GITHUB_RUN_URL,
|
||||
)
|
||||
|
@ -8,13 +8,16 @@ import sys
|
||||
|
||||
from github import Github
|
||||
|
||||
from env_helper import CACHES_PATH, TEMP_PATH, GITHUB_SERVER_URL, GITHUB_REPOSITORY
|
||||
from pr_info import FORCE_TESTS_LABEL, PRInfo, SKIP_SIMPLE_CHECK_LABEL
|
||||
from env_helper import CACHES_PATH, TEMP_PATH
|
||||
from pr_info import FORCE_TESTS_LABEL, PRInfo
|
||||
from s3_helper import S3Helper
|
||||
from get_robot_token import get_best_robot_token
|
||||
from upload_result_helper import upload_results
|
||||
from docker_pull_helper import get_image_with_version
|
||||
from commit_status_helper import post_commit_status, get_commit
|
||||
from commit_status_helper import (
|
||||
post_commit_status,
|
||||
fail_simple_check,
|
||||
)
|
||||
from clickhouse_helper import (
|
||||
ClickHouseHelper,
|
||||
mark_flaky_tests,
|
||||
@ -219,16 +222,5 @@ if __name__ == "__main__":
|
||||
if FORCE_TESTS_LABEL in pr_info.labels and state != "error":
|
||||
print(f"'{FORCE_TESTS_LABEL}' enabled, will report success")
|
||||
else:
|
||||
if SKIP_SIMPLE_CHECK_LABEL not in pr_info.labels:
|
||||
url = (
|
||||
f"{GITHUB_SERVER_URL}/{GITHUB_REPOSITORY}/"
|
||||
"blob/master/.github/PULL_REQUEST_TEMPLATE.md?plain=1"
|
||||
)
|
||||
commit = get_commit(gh, pr_info.sha)
|
||||
commit.create_status(
|
||||
context="Simple Check",
|
||||
description=f"{NAME} failed",
|
||||
state="failed",
|
||||
target_url=url,
|
||||
)
|
||||
fail_simple_check(gh, pr_info, f"{NAME} failed")
|
||||
sys.exit(1)
|
||||
|
@ -36,3 +36,9 @@ class RerunHelper:
|
||||
):
|
||||
return True
|
||||
return False
|
||||
|
||||
def get_finished_status(self):
|
||||
for status in self.statuses:
|
||||
if self.check_name in status.context:
|
||||
return status
|
||||
return None
|
||||
|
@ -6,7 +6,12 @@ from typing import Tuple
|
||||
|
||||
from github import Github
|
||||
|
||||
from commit_status_helper import get_commit, post_labels, remove_labels
|
||||
from commit_status_helper import (
|
||||
get_commit,
|
||||
post_labels,
|
||||
remove_labels,
|
||||
create_simple_check,
|
||||
)
|
||||
from env_helper import GITHUB_RUN_URL, GITHUB_REPOSITORY, GITHUB_SERVER_URL
|
||||
from get_robot_token import get_best_robot_token
|
||||
from pr_info import FORCE_TESTS_LABEL, PRInfo
|
||||
@ -223,12 +228,7 @@ if __name__ == "__main__":
|
||||
if pr_labels_to_remove:
|
||||
remove_labels(gh, pr_info, pr_labels_to_remove)
|
||||
|
||||
commit.create_status(
|
||||
context="Simple Check",
|
||||
description="Skipped",
|
||||
state="success",
|
||||
target_url=GITHUB_RUN_URL,
|
||||
)
|
||||
create_simple_check(gh, pr_info)
|
||||
|
||||
if description_error:
|
||||
print(
|
||||
|
@ -10,15 +10,16 @@ from github import Github
|
||||
from env_helper import (
|
||||
RUNNER_TEMP,
|
||||
GITHUB_WORKSPACE,
|
||||
GITHUB_REPOSITORY,
|
||||
GITHUB_SERVER_URL,
|
||||
)
|
||||
from s3_helper import S3Helper
|
||||
from pr_info import PRInfo, SKIP_SIMPLE_CHECK_LABEL
|
||||
from pr_info import PRInfo
|
||||
from get_robot_token import get_best_robot_token
|
||||
from upload_result_helper import upload_results
|
||||
from docker_pull_helper import get_image_with_version
|
||||
from commit_status_helper import post_commit_status, get_commit
|
||||
from commit_status_helper import (
|
||||
post_commit_status,
|
||||
fail_simple_check,
|
||||
)
|
||||
from clickhouse_helper import (
|
||||
ClickHouseHelper,
|
||||
mark_flaky_tests,
|
||||
@ -124,17 +125,6 @@ if __name__ == "__main__":
|
||||
)
|
||||
ch_helper.insert_events_into(db="default", table="checks", events=prepared_events)
|
||||
|
||||
if state == "error":
|
||||
if SKIP_SIMPLE_CHECK_LABEL not in pr_info.labels:
|
||||
url = (
|
||||
f"{GITHUB_SERVER_URL}/{GITHUB_REPOSITORY}/"
|
||||
"blob/master/.github/PULL_REQUEST_TEMPLATE.md?plain=1"
|
||||
)
|
||||
commit = get_commit(gh, pr_info.sha)
|
||||
commit.create_status(
|
||||
context="Simple Check",
|
||||
description=f"{NAME} failed",
|
||||
state="failed",
|
||||
target_url=url,
|
||||
)
|
||||
if state in ["error", "failure"]:
|
||||
fail_simple_check(gh, pr_info, f"{NAME} failed")
|
||||
sys.exit(1)
|
||||
|
Loading…
Reference in New Issue
Block a user