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
1 change: 1 addition & 0 deletions fleet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 15 additions & 5 deletions src/aio_fleet/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions src/aio_fleet/control_plane.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ def registry_publish_command(
"docker",
"buildx",
"build",
"--progress=plain",
"--push",
"--platform",
str(platforms),
Expand Down
6 changes: 3 additions & 3 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down
25 changes: 25 additions & 0 deletions tests/test_control_plane.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from aio_fleet.control_plane import (
Step,
central_check_steps,
registry_publish_command,
run_central_trunk,
run_steps,
)
Expand Down Expand Up @@ -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")

Expand Down
Loading