From 68e8ac0aced2e98ebe62e63fddf36165c9c041af Mon Sep 17 00:00:00 2001 From: Andrew Grimberg Date: Fri, 26 Jan 2024 10:50:04 -0800 Subject: [PATCH] Fix: On error continue processing workflows In the case where a workflow does not trigger for reason and throws an exception, this stops processing of all other workflows that were detected. This an cause problems as other workflows may pass. As there is no easy way to bubble triggering issues to end users not having jobs (that might pass) not trigger because of a failure of a different workflow (that doesn't get reported) is a problem. Issue: RELENG-5100 Change-Id: I0bd20efa6cc8077e7453d4523e40ee92052c825a Signed-off-by: Andrew Grimberg --- src/gerrit_to_platform/helpers.py | 34 ++++++++++++++++++------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/src/gerrit_to_platform/helpers.py b/src/gerrit_to_platform/helpers.py index debd993..ea00fc7 100644 --- a/src/gerrit_to_platform/helpers.py +++ b/src/gerrit_to_platform/helpers.py @@ -127,13 +127,16 @@ def find_and_dispatch(project: str, workflow_filter: str, inputs: Dict[str, str] + f"{inputs['GERRIT_CHANGE_NUMBER']} patch " + inputs["GERRIT_PATCHSET_NUMBER"] ) - dispatcher( - owner, - repo, - workflow["id"], - f"refs/heads/{inputs['GERRIT_BRANCH']}", - inputs, - ) + try: + dispatcher( + owner, + repo, + workflow["id"], + f"refs/heads/{inputs['GERRIT_BRANCH']}", + inputs, + ) + except Exception as e: + print(f"Failed to dispatch workflow: {e}") magic_repo = get_magic_repo(platform) if magic_repo: @@ -152,13 +155,16 @@ def find_and_dispatch(project: str, workflow_filter: str, inputs: Dict[str, str] + f"{inputs['GERRIT_PATCHSET_NUMBER']} against " + f"{platform.value}:{owner}/{repo}" ) - dispatcher( - owner, - magic_repo, - workflow["id"], - "refs/heads/main", - inputs, - ) + try: + dispatcher( + owner, + magic_repo, + workflow["id"], + "refs/heads/main", + inputs, + ) + except Exception as e: + print(f"Failed to dispatch workflow: {e}") def get_change_id(change: str) -> str: