From 53a20cbaa45640f80615307da3061ec8d05b3d68 Mon Sep 17 00:00:00 2001 From: JSONbored <49853598+JSONbored@users.noreply.github.com> Date: Sat, 9 May 2026 21:31:15 -0700 Subject: [PATCH] fix(ci): stream registry publish output --- fleet.yml | 1 + src/aio_fleet/cli.py | 20 +++++++++++++++----- src/aio_fleet/control_plane.py | 1 + tests/test_cli.py | 6 +++--- tests/test_control_plane.py | 25 +++++++++++++++++++++++++ 5 files changed, 45 insertions(+), 8 deletions(-) diff --git a/fleet.yml b/fleet.yml index 584e98b..a9ab99f 100644 --- a/fleet.yml +++ b/fleet.yml @@ -507,6 +507,7 @@ repos: docker_cache_scope: mem0-aio-image pytest_image_tag: mem0-aio:pytest unit_pytest_args: tests/template + registry_publish_timeout_seconds: 7200 publish_profile: changelog-version release_name: Mem0-AIO upstream_name: Mem0 diff --git a/src/aio_fleet/cli.py b/src/aio_fleet/cli.py index 9f314f8..8657eac 100644 --- a/src/aio_fleet/cli.py +++ b/src/aio_fleet/cli.py @@ -98,6 +98,20 @@ def _run( ) +def _run_streaming( + cmd: list[str], + cwd: Path | None = None, + env: dict[str, str] | None = None, +) -> subprocess.CompletedProcess[str]: + return subprocess.run( # nosec B603 + cmd, + cwd=cwd, + env=env, + check=False, + text=True, + ) + + def _repo_python(repo_path: Path) -> str: for candidate in ( repo_path / ".venv" / "bin" / "python", @@ -1106,14 +1120,10 @@ def cmd_registry_publish(args: argparse.Namespace) -> int: print(f"{repo.name}:{args.component}: registry=publishing", flush=True) try: with _registry_publish_environment(repo) as publish_env: - result = _run(command, cwd=repo.path, env=publish_env) + result = _run_streaming(command, cwd=repo.path, env=publish_env) except RuntimeError as exc: print(str(exc), file=sys.stderr) return 1 - if result.stdout: - print(result.stdout, end="") - if result.stderr: - print(result.stderr, file=sys.stderr, end="") if result.returncode != 0: return result.returncode return cmd_registry_verify( diff --git a/src/aio_fleet/control_plane.py b/src/aio_fleet/control_plane.py index 1761cbf..67a18fd 100644 --- a/src/aio_fleet/control_plane.py +++ b/src/aio_fleet/control_plane.py @@ -381,6 +381,7 @@ def registry_publish_command( "docker", "buildx", "build", + "--progress=plain", "--push", "--platform", str(platforms), diff --git a/tests/test_cli.py b/tests/test_cli.py index 4c1b16f..978e0c0 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -709,7 +709,7 @@ def fake_registry_verify(args: Namespace) -> int: seen.setdefault("verify_calls", []).append(args) return 0 - monkeypatch.setattr(cli, "_run", fake_run) + monkeypatch.setattr(cli, "_run_streaming", fake_run) monkeypatch.setattr(cli, "verify_registry_tags", lambda _tags: ["tag missing"]) monkeypatch.setattr(cli, "cmd_registry_verify", fake_registry_verify) @@ -754,7 +754,7 @@ def fake_run( seen["publish_env"] = env return SimpleNamespace(returncode=0, stdout="", stderr="") - monkeypatch.setattr(cli, "_run", fake_run) + monkeypatch.setattr(cli, "_run_streaming", fake_run) monkeypatch.setattr(cli, "verify_registry_tags", lambda _tags: []) monkeypatch.setattr(cli, "cmd_registry_verify", lambda _args: 0) @@ -817,7 +817,7 @@ def fake_publish(command: list[str], cwd: Path | None = None, env=None): monkeypatch.setenv("GH_TOKEN", "gh-token") monkeypatch.setenv("GITHUB_TOKEN", "github-token") monkeypatch.setattr(cli.subprocess, "run", fake_docker) - monkeypatch.setattr(cli, "_run", fake_publish) + monkeypatch.setattr(cli, "_run_streaming", fake_publish) monkeypatch.setattr(cli, "verify_registry_tags", lambda _tags: ["tag missing"]) monkeypatch.setattr(cli, "cmd_registry_verify", lambda _args: 0) diff --git a/tests/test_control_plane.py b/tests/test_control_plane.py index 3a3fb45..19e37fa 100644 --- a/tests/test_control_plane.py +++ b/tests/test_control_plane.py @@ -6,6 +6,7 @@ from aio_fleet.control_plane import ( Step, central_check_steps, + registry_publish_command, run_central_trunk, run_steps, ) @@ -71,6 +72,30 @@ def test_central_check_steps_for_push_include_integration_trunk_and_publish() -> assert trunk.inherit_secrets is False # nosec B101 +def test_central_check_steps_use_mem0_publish_timeout() -> None: + repo = load_manifest(ROOT / "fleet.yml").repo("mem0-aio") + + steps = central_check_steps( + repo, event="push", publish=True, include_integration=False + ) + + publish = [step for step in steps if step.name == "registry-publish"][0] + assert publish.timeout_seconds == 7200 # nosec B101 + + +def test_registry_publish_command_uses_plain_progress() -> None: + repo = load_manifest(ROOT / "fleet.yml").repo("mem0-aio") + + command = registry_publish_command(repo, sha="a" * 40) + + assert command[:4] == [ # nosec B101 + "docker", + "buildx", + "build", + "--progress=plain", + ] + + def test_central_check_steps_for_push_without_publish_lets_tests_build_image() -> None: repo = load_manifest(ROOT / "fleet.yml").repo("sure-aio")