remove A sync check from MQ for a while

This commit is contained in:
Max Kainov 2024-04-12 11:23:43 +00:00
parent 0d2e0e3131
commit 3f10530c28

View File

@ -4,13 +4,12 @@
import argparse
import sys
import time
from get_robot_token import get_best_robot_token
from pr_info import PRInfo
from github_helper import GitHub
from commit_status_helper import get_commit, post_commit_status
from report import FAILURE, SUCCESS
from report import SUCCESS
def parse_args() -> argparse.Namespace:
@ -54,21 +53,23 @@ def merge_sync_pr(gh, sync_pr):
def set_sync_status(gh, pr_info, sync_pr):
# FIXME: uncomment posting red Sync status to prohibit merge in MQ if PR state fetching works good
if not sync_pr:
post_commit_status(
get_commit(gh, pr_info.sha), FAILURE, "", "Sync PR not found", "A Sync"
)
# post_commit_status(
# get_commit(gh, pr_info.sha), FAILURE, "", "Sync PR not found", "A Sync"
# )
return
retries = 0
while sync_pr.mergeable_state == "unknown" and retries < 3:
retries += 1
print(f"Unknown status. Trying to fetch again [{retries}/3]")
time.sleep(5)
sync_pr = gh.get_pulls_from_search(
query=f"head:sync-upstream/pr/{sync_pr.number} org:ClickHouse type:pr",
repo="ClickHouse/clickhouse-private",
)
# FIXME: fetch sync pr in a proper way
# retries = 0
# while sync_pr.mergeable_state == "unknown" and retries < 3:
# retries += 1
# print(f"Unknown status. Trying to fetch again [{retries}/3]")
# time.sleep(5)
# sync_pr = gh.get_pulls_from_search(
# query=f"head:sync-upstream/pr/{sync_pr.number} org:ClickHouse type:pr",
# repo="ClickHouse/clickhouse-private",
# )
if sync_pr.mergeable_state == "clean":
print(f"Sync PR [{sync_pr.number}] is clean")
@ -77,13 +78,13 @@ def set_sync_status(gh, pr_info, sync_pr):
print(
f"Sync PR [{sync_pr}] is not mergeable, state [{sync_pr.mergeable_state}]"
)
post_commit_status(
get_commit(gh, pr_info.sha),
FAILURE,
"",
f"state: {sync_pr.mergeable_state}",
"A Sync",
)
# post_commit_status(
# get_commit(gh, pr_info.sha),
# FAILURE,
# "",
# f"state: {sync_pr.mergeable_state}",
# "A Sync",
# )
def main():