diff --git a/tests/ci/ci_buddy.py b/tests/ci/ci_buddy.py index 527eca3107c..164af72f4be 100644 --- a/tests/ci/ci_buddy.py +++ b/tests/ci/ci_buddy.py @@ -9,6 +9,9 @@ from botocore.exceptions import ClientError from ci_config import CI from ci_utils import WithIter +from commit_status_helper import get_commit_filtered_statuses, get_repo +from get_robot_token import get_best_robot_token +from github_helper import GitHub from pr_info import PRInfo @@ -52,7 +55,8 @@ class CIBuddy: self.pr_number = pr_info.number self.head_ref = pr_info.head_ref self.commit_url = pr_info.commit_html_url - self.sha = pr_info.sha[:10] + self.sha_full = pr_info.sha + self.sha = self.sha_full[:10] def check_workflow(self): CI.GH.print_workflow_results() @@ -64,11 +68,22 @@ class CIBuddy: return res = CI.GH.get_workflow_job_result(CI.GH.ActionsNames.RunConfig) - if res != CI.GH.ActionStatuses.SUCCESS: - print(f"ERROR: RunConfig status is [{res}] - post report to slack") - self.post_job_error( - f"{CI.Envs.GITHUB_WORKFLOW} Workflow Failed", critical=True + if res == CI.GH.ActionStatuses.SUCCESS: + # the normal case + return + + gh = GitHub(get_best_robot_token()) + commit = get_repo(gh).get_commit(self.sha_full) + statuses = get_commit_filtered_statuses(commit) + if any(True for st in statuses if st.context == CI.StatusNames.PR_CHECK): + print( + f"INFO: RunConfig status is [{res}], but it " + f'contains "{CI.StatusNames.PR_CHECK}" status, do not report error' ) + return + + print(f"ERROR: RunConfig status is [{res}] - post report to slack") + self.post_job_error(f"{CI.Envs.GITHUB_WORKFLOW} Workflow Failed", critical=True) @staticmethod def _get_webhooks():