mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Use NotSet in post_commit_status for optional arguments
This commit is contained in:
parent
c66e50f283
commit
e8cf417350
@ -10,6 +10,7 @@ from typing import List, Tuple
|
||||
|
||||
from ci_config import CI_CONFIG, BuildConfig
|
||||
from commit_status_helper import (
|
||||
NotSet,
|
||||
get_commit_filtered_statuses,
|
||||
get_commit,
|
||||
post_commit_status,
|
||||
@ -255,7 +256,7 @@ def mark_failed_reports_pending(build_name: str, pr_info: PRInfo) -> None:
|
||||
post_commit_status(
|
||||
commit,
|
||||
"pending",
|
||||
status.url,
|
||||
status.target_url or NotSet,
|
||||
"Set to pending on rerun",
|
||||
report_status,
|
||||
pr_info,
|
||||
|
@ -3,10 +3,11 @@
|
||||
import csv
|
||||
import os
|
||||
import time
|
||||
from typing import List, Literal, Optional
|
||||
from typing import List, Literal, Optional, Union
|
||||
import logging
|
||||
|
||||
from github import Github
|
||||
from github.GithubObject import _NotSetType, NotSet as NotSet # type: ignore
|
||||
from github.Commit import Commit
|
||||
from github.CommitStatus import CommitStatus
|
||||
from github.IssueComment import IssueComment
|
||||
@ -75,9 +76,9 @@ def get_commit(gh: Github, commit_sha: str, retry_count: int = RETRY) -> Commit:
|
||||
def post_commit_status(
|
||||
commit: Commit,
|
||||
state: str,
|
||||
report_url: str,
|
||||
description: str,
|
||||
check_name: str,
|
||||
report_url: Union[_NotSetType, str] = NotSet,
|
||||
description: Union[_NotSetType, str] = NotSet,
|
||||
check_name: Union[_NotSetType, str] = NotSet,
|
||||
pr_info: Optional[PRInfo] = None,
|
||||
) -> None:
|
||||
"""The parameters are given in the same order as for commit.create_status,
|
||||
|
@ -10,6 +10,7 @@ from github import Github
|
||||
|
||||
from clickhouse_helper import ClickHouseHelper, prepare_tests_results_for_clickhouse
|
||||
from commit_status_helper import (
|
||||
NotSet,
|
||||
RerunHelper,
|
||||
get_commit,
|
||||
post_commit_status,
|
||||
@ -66,7 +67,9 @@ def main():
|
||||
|
||||
if not pr_info.has_changes_in_documentation() and not args.force:
|
||||
logging.info("No changes in documentation")
|
||||
post_commit_status(commit, "success", "", "No changes in docs", NAME, pr_info)
|
||||
post_commit_status(
|
||||
commit, "success", NotSet, "No changes in docs", NAME, pr_info
|
||||
)
|
||||
sys.exit(0)
|
||||
|
||||
if pr_info.has_changes_in_documentation():
|
||||
|
@ -4,11 +4,11 @@ from github import Github
|
||||
|
||||
from commit_status_helper import (
|
||||
CI_STATUS_NAME,
|
||||
NotSet,
|
||||
get_commit,
|
||||
get_commit_filtered_statuses,
|
||||
post_commit_status,
|
||||
)
|
||||
from env_helper import GITHUB_RUN_URL
|
||||
from get_robot_token import get_best_robot_token
|
||||
from pr_info import PRInfo
|
||||
|
||||
@ -32,7 +32,7 @@ def main():
|
||||
post_commit_status(
|
||||
commit,
|
||||
"success",
|
||||
status.target_url or "",
|
||||
status.target_url or NotSet,
|
||||
"All checks finished",
|
||||
CI_STATUS_NAME,
|
||||
pr_info,
|
||||
|
@ -20,6 +20,7 @@ from clickhouse_helper import (
|
||||
prepare_tests_results_for_clickhouse,
|
||||
)
|
||||
from commit_status_helper import (
|
||||
NotSet,
|
||||
RerunHelper,
|
||||
get_commit,
|
||||
override_status,
|
||||
@ -287,7 +288,12 @@ def main():
|
||||
state = override_status("success", check_name, validate_bugfix_check)
|
||||
if args.post_commit_status == "commit_status":
|
||||
post_commit_status(
|
||||
commit, state, "", NO_CHANGES_MSG, check_name_with_group, pr_info
|
||||
commit,
|
||||
state,
|
||||
NotSet,
|
||||
NO_CHANGES_MSG,
|
||||
check_name_with_group,
|
||||
pr_info,
|
||||
)
|
||||
elif args.post_commit_status == "file":
|
||||
post_commit_status_to_file(
|
||||
|
@ -4,7 +4,7 @@ import argparse
|
||||
import logging
|
||||
import os
|
||||
|
||||
from commit_status_helper import get_commit, post_commit_status
|
||||
from commit_status_helper import NotSet, get_commit, post_commit_status
|
||||
from env_helper import GITHUB_JOB_URL
|
||||
from get_robot_token import get_best_robot_token
|
||||
from github_helper import GitHub
|
||||
@ -49,7 +49,7 @@ def main():
|
||||
commit = get_commit(gh, args.commit)
|
||||
gh.get_rate_limit()
|
||||
post_commit_status(
|
||||
commit, "success", url, description, RELEASE_READY_STATUS, pr_info
|
||||
commit, "success", url or NotSet, description, RELEASE_READY_STATUS, pr_info
|
||||
)
|
||||
|
||||
|
||||
|
@ -8,6 +8,7 @@ from github import Github
|
||||
|
||||
from commit_status_helper import (
|
||||
CI_STATUS_NAME,
|
||||
NotSet,
|
||||
format_description,
|
||||
get_commit,
|
||||
post_commit_status,
|
||||
@ -16,7 +17,7 @@ from commit_status_helper import (
|
||||
set_mergeable_check,
|
||||
)
|
||||
from docs_check import NAME as DOCS_NAME
|
||||
from env_helper import GITHUB_RUN_URL, GITHUB_REPOSITORY, GITHUB_SERVER_URL
|
||||
from env_helper import GITHUB_REPOSITORY, GITHUB_SERVER_URL
|
||||
from get_robot_token import get_best_robot_token
|
||||
from pr_info import FORCE_TESTS_LABEL, PRInfo
|
||||
from workflow_approve_rerun_lambda.app import TRUSTED_CONTRIBUTORS
|
||||
@ -256,7 +257,7 @@ def main():
|
||||
post_commit_status( # do not pass pr_info here intentionally
|
||||
commit,
|
||||
"pending",
|
||||
"",
|
||||
NotSet,
|
||||
f"expect adding docs for {FEATURE_LABEL}",
|
||||
DOCS_NAME,
|
||||
)
|
||||
@ -287,16 +288,17 @@ def main():
|
||||
)
|
||||
sys.exit(1)
|
||||
|
||||
url = GITHUB_RUN_URL
|
||||
if not can_run:
|
||||
print("::notice ::Cannot run")
|
||||
post_commit_status(
|
||||
commit, labels_state, url, description, CI_STATUS_NAME, pr_info
|
||||
commit, labels_state, NotSet, description, CI_STATUS_NAME, pr_info
|
||||
)
|
||||
sys.exit(1)
|
||||
else:
|
||||
print("::notice ::Can run")
|
||||
post_commit_status(commit, "pending", url, description, CI_STATUS_NAME, pr_info)
|
||||
post_commit_status(
|
||||
commit, "pending", NotSet, description, CI_STATUS_NAME, pr_info
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
Loading…
Reference in New Issue
Block a user