Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions github_scripts/get_git_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@
logger = logging.getLogger(__name__)


class SubprocessRunError(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]:
Expand All @@ -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 SubprocessRunError(
result.returncode, command, result.stdout, result.stderr
)
return result

Expand Down Expand Up @@ -198,14 +211,14 @@ 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)
if unmerged_files:
handle_merge_conflicts(source, ref, dest, dest.name)
else:
raise subprocess.CalledProcessError(
raise SubprocessRunError(
result.returncode, command, result.stdout, result.stderr
)

Expand Down
1 change: 1 addition & 0 deletions github_scripts/merge_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion github_scripts/suite_report_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading