mirror of
https://github.com/rennf93/roboco.git
synced 2026-08-03 07:23:24 +02:00
feat(deploy): run RoboCo from pre-built registry images
The orchestrator spawned agents only by bare image names and built any
missing image from source on the host, so a deployment had to carry the
build context and a toolchain — there was no way to just pull and run the
images the release workflow publishes.
Add two settings (default empty = unchanged local-build behavior):
ROBOCO_AGENT_IMAGE_REGISTRY and ROBOCO_AGENT_IMAGE_TAG. When a registry is
set, the orchestrator spawns and ensures {registry}/roboco-agent-*[:tag] and
pulls (never builds) any image it lacks. Also adds the previously-missing
agent-secretary image to the lazy-build map.
Ship docker-compose.registry.yml: a standalone compose that pulls every
published image (GHCR or Docker Hub, pinnable version) and wires the
orchestrator to spawn the matching pre-built agent images. The existing
build compose files are unchanged.
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
"""Agent image resolution — local build vs. pre-built registry images.
|
||||
|
||||
``_qualify_agent_image`` decides what image name the orchestrator spawns (and
|
||||
ensures). Empty registry/tag MUST return the bare name unchanged so the local
|
||||
build flow and existing NAS deployment are untouched; a configured registry
|
||||
switches every agent to the pre-built ``{registry}/roboco-agent-*[:tag]``.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
from roboco.runtime import orchestrator as orch
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("registry", "tag", "bare", "expected"),
|
||||
[
|
||||
# Default: no registry, no tag -> bare name unchanged (local build).
|
||||
("", "", "roboco-agent-pm", "roboco-agent-pm"),
|
||||
# Registry only -> qualified, implicit :latest.
|
||||
("ghcr.io/rennf93", "", "roboco-agent-pm", "ghcr.io/rennf93/roboco-agent-pm"),
|
||||
# Trailing slash on the registry is tolerated.
|
||||
(
|
||||
"ghcr.io/rennf93/",
|
||||
"latest",
|
||||
"roboco-agent-pm",
|
||||
"ghcr.io/rennf93/roboco-agent-pm:latest",
|
||||
),
|
||||
# Docker Hub namespace + pinned version.
|
||||
(
|
||||
"docker.io/renzof93",
|
||||
"0.5.0",
|
||||
"roboco-agent-base",
|
||||
"docker.io/renzof93/roboco-agent-base:0.5.0",
|
||||
),
|
||||
# Tag without registry is still applied (edge case, valid).
|
||||
("", "latest", "roboco-agent-pm", "roboco-agent-pm:latest"),
|
||||
],
|
||||
)
|
||||
def test_qualify_agent_image(
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
registry: str,
|
||||
tag: str,
|
||||
bare: str,
|
||||
expected: str,
|
||||
) -> None:
|
||||
monkeypatch.setattr(orch.settings, "agent_image_registry", registry)
|
||||
monkeypatch.setattr(orch.settings, "agent_image_tag", tag)
|
||||
assert orch._qualify_agent_image(bare) == expected
|
||||
|
||||
|
||||
def test_get_agent_image_local_default(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
monkeypatch.setattr(orch.settings, "agent_image_registry", "")
|
||||
monkeypatch.setattr(orch.settings, "agent_image_tag", "")
|
||||
assert orch.get_agent_image("be-dev-1") == "roboco-agent-dev-be"
|
||||
# Unknown agent id falls back to the base image.
|
||||
assert orch.get_agent_image("pr-reviewer-1") == "roboco-agent-base"
|
||||
|
||||
|
||||
def test_get_agent_image_registry_mode(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
monkeypatch.setattr(orch.settings, "agent_image_registry", "ghcr.io/rennf93")
|
||||
monkeypatch.setattr(orch.settings, "agent_image_tag", "0.5.0")
|
||||
assert (
|
||||
orch.get_agent_image("be-dev-1")
|
||||
== "ghcr.io/rennf93/roboco-agent-dev-be:0.5.0"
|
||||
)
|
||||
assert (
|
||||
orch.get_agent_image("pr-reviewer-1")
|
||||
== "ghcr.io/rennf93/roboco-agent-base:0.5.0"
|
||||
)
|
||||
Reference in New Issue
Block a user