From 6e490e0d897dcc66ca308eb8fd8f942cdbb7d29d Mon Sep 17 00:00:00 2001 From: James Bruten <109733895+james-bruten-mo@users.noreply.github.com> Date: Tue, 31 Mar 2026 11:27:44 +0100 Subject: [PATCH 1/4] initial custom error --- github_scripts/get_git_sources.py | 19 ++++++++++++++++--- github_scripts/merge_sources.py | 1 + 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/github_scripts/get_git_sources.py b/github_scripts/get_git_sources.py index f9fe168e..fc22015a 100644 --- a/github_scripts/get_git_sources.py +++ b/github_scripts/get_git_sources.py @@ -19,6 +19,19 @@ logger = logging.getLogger(__name__) +class subprocess_run_error(Exception): + def __init__(self, command, returncode, stdout, stderr): + self.command = command + self.returncode = returncode + self.stdout = stdout + self.stderr = stderr + self.message = ( + f"Errorcode {returncode} raised when running command '{command}\n\n" + f"stdout:\n{stdout}\n\nstderr:\n{stderr}" + ) + super.__init__(self.message) + + def run_command( command: str, check: bool = True, capture: bool = True, timeout: int = 600 ) -> Optional[subprocess.CompletedProcess]: @@ -44,8 +57,8 @@ def run_command( if check and result.returncode != 0: err_msg = (result.stderr or "").strip() logger.error(f"[FAIL] Command failed: {command}\nError: {err_msg}") - raise subprocess.CalledProcessError( - result.returncode, args, output=result.stdout, stderr=result.stderr + raise subprocess_run_error( + result.returncode, command, result.stdout, result.stderr ) return result @@ -205,7 +218,7 @@ def merge_source( if unmerged_files: handle_merge_conflicts(source, ref, dest, dest.name) else: - raise subprocess.CalledProcessError( + raise subprocess_run_error( result.returncode, command, result.stdout, result.stderr ) diff --git a/github_scripts/merge_sources.py b/github_scripts/merge_sources.py index acb63c22..9f884911 100755 --- a/github_scripts/merge_sources.py +++ b/github_scripts/merge_sources.py @@ -32,6 +32,7 @@ def parse_args(): parser.add_argument( "-p", "--path", + type=Path, default=None, help="The path to extract the sources to. If part of a cylc suite, it will " "default to $CYLC_WORKFLOW_SHARE_DIR/source, otherwise __file__/source", From 2a4048d176e1881649c42ad596962c6001736223 Mon Sep 17 00:00:00 2001 From: James Bruten <109733895+james-bruten-mo@users.noreply.github.com> Date: Tue, 31 Mar 2026 11:36:07 +0100 Subject: [PATCH 2/4] syntax --- github_scripts/get_git_sources.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/github_scripts/get_git_sources.py b/github_scripts/get_git_sources.py index fc22015a..ee964033 100644 --- a/github_scripts/get_git_sources.py +++ b/github_scripts/get_git_sources.py @@ -19,7 +19,7 @@ logger = logging.getLogger(__name__) -class subprocess_run_error(Exception): +class SubprocessRunError(Exception): def __init__(self, command, returncode, stdout, stderr): self.command = command self.returncode = returncode @@ -29,7 +29,7 @@ def __init__(self, command, returncode, stdout, stderr): f"Errorcode {returncode} raised when running command '{command}\n\n" f"stdout:\n{stdout}\n\nstderr:\n{stderr}" ) - super.__init__(self.message) + super().__init__(self.message) def run_command( @@ -57,7 +57,7 @@ def run_command( if check and result.returncode != 0: err_msg = (result.stderr or "").strip() logger.error(f"[FAIL] Command failed: {command}\nError: {err_msg}") - raise subprocess_run_error( + raise SubprocessRunError( result.returncode, command, result.stdout, result.stderr ) return result @@ -218,7 +218,7 @@ def merge_source( if unmerged_files: handle_merge_conflicts(source, ref, dest, dest.name) else: - raise subprocess_run_error( + raise SubprocessRunError( result.returncode, command, result.stdout, result.stderr ) From fd6a580ac74d3be3067fe789842cf46dba162462 Mon Sep 17 00:00:00 2001 From: James Bruten <109733895+james-bruten-mo@users.noreply.github.com> Date: Tue, 31 Mar 2026 12:02:04 +0100 Subject: [PATCH 3/4] check for missing config owner --- github_scripts/suite_report_git.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github_scripts/suite_report_git.py b/github_scripts/suite_report_git.py index 5bf32254..340110c4 100755 --- a/github_scripts/suite_report_git.py +++ b/github_scripts/suite_report_git.py @@ -238,7 +238,7 @@ def create_um_config_owner_table(self, owners: Dict) -> None: # Create a dict with owners as the key table_dict = defaultdict(list) for config in failed_configs: - owner, others = owners[config] + owner, others = owners.get(config, "UNKNOWN") if others != "--": config = f"{config} ({others})" table_dict[owner].append(config) From c1ffb10d4c2be71b5015a0d0a577a2583ddc5f65 Mon Sep 17 00:00:00 2001 From: James Bruten <109733895+james-bruten-mo@users.noreply.github.com> Date: Tue, 31 Mar 2026 12:50:00 +0100 Subject: [PATCH 4/4] add no-edit --- github_scripts/get_git_sources.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github_scripts/get_git_sources.py b/github_scripts/get_git_sources.py index ee964033..ffee9652 100644 --- a/github_scripts/get_git_sources.py +++ b/github_scripts/get_git_sources.py @@ -211,7 +211,7 @@ def merge_source( run_command(f"git -C {dest} fetch local {fetch}") - command = f"git -C {dest} merge --no-gpg-sign FETCH_HEAD" + command = f"git -C {dest} merge --no-gpg-sign --no-edit FETCH_HEAD" result = run_command(command, check=False) if result.returncode: unmerged_files = get_unmerged(dest)