Publish curated Unraid-AppOps-Gateway source from c61e0e1e292914893b40354f904f23dd9fd4a958

This commit is contained in:
Public Source Publisher committed 2026-10-09 21:29:20 +00:00
1 parent b47ce43436
commit 9b94d8d0f5
18 files changed
+1651 -75

No files matched your search

@@ -14,20 +14,33 @@ def test_promoter_archive_covers_every_required_installer_source():
spec = helper_container_spec(revision="a" * 40, image_id="sha256:" + "b" * 64)
command = spec["Cmd"][2].replace("\\\n", " ")
archive = re.search(r'archive --format=tar "\$revision"(.*?)> "\$work/controller.tar"', command, re.S)
archive = re.search(
r'archive --format=tar "\$revision"(.*?)> "\$work/controller.tar"',
command,
re.S,
)
assert archive is not None
packaged = shlex.split(archive.group(1))
installer = (ROOT / "scripts/upgrade_deployment_controller.sh").read_text(encoding="utf-8")
installer = (ROOT / "scripts/upgrade_deployment_controller.sh").read_text(
encoding="utf-8"
)
required_block = re.search(r"(?m)^source_paths=\(\n(.*?)\n\)", installer, re.S)
assert required_block is not None
required = shlex.split(required_block.group(1))
assert required
assert all(any(path == prefix or path.startswith(prefix + "/") for prefix in packaged) for path in required)
assert all(
any(path == prefix or path.startswith(prefix + "/") for prefix in packaged)
for path in required
)
def test_controller_promoter_action_is_fixed_and_registered():
registry = (ROOT / "backend/app/services/action_registry.py").read_text(encoding="utf-8")
execution = (ROOT / "backend/app/services/action_execution.py").read_text(encoding="utf-8")
registry = (ROOT / "backend/app/services/action_registry.py").read_text(
encoding="utf-8"
)
execution = (ROOT / "backend/app/services/action_execution.py").read_text(
encoding="utf-8"
)
assert "'controller.artifact.promote'" in registry
assert "return 'tower/deployment-controller'" in registry
assert 'action == "controller.artifact.promote"' in execution
@@ -46,7 +59,7 @@ def test_controller_promoter_helper_spec_is_fixed_and_bounded():
spec = helper_container_spec(revision=revision, image_id=image_id)
assert HELPER_NAME == "itworx-controller-artifact-promoter-modern"
assert CONTROLLER_VERSION == "2.1.20"
assert CONTROLLER_VERSION == "2.1.21"
assert re.fullmatch(r"2\.1\.\d+", CONTROLLER_VERSION)
assert spec["Image"] == image_id
assert spec["HostConfig"]["Privileged"] is False
@@ -68,23 +81,29 @@ def test_controller_promoter_helper_spec_is_fixed_and_bounded():
command = spec["Cmd"][2]
assert "mktemp -d -p /tmp itworx-controller-artifact-promoter-" in command
assert f"itworx-controller-artifact-promoter-{revision[:12]}.XXXXXX" in command
assert "/mnt/cache/appdata/gitea-deploy-runners/.controller-promoter-" not in command
assert (
"/mnt/cache/appdata/gitea-deploy-runners/.controller-promoter-" not in command
)
assert "work='/mnt/cache" not in command
assert "rm -rf -- \"$work\"" in command
assert "scripts/upgrade_deployment_controller.sh > \"$work/controller.tar\"" in command
assert "chmod 0600 \"$work/controller.tar\"" in command
assert 'rm -rf -- "$work"' in command
assert (
'scripts/upgrade_deployment_controller.sh > "$work/controller.tar"' in command
)
assert 'chmod 0600 "$work/controller.tar"' in command
assert "scripts/prepare_controller_hub_release_volume.py" in command
assert "scripts/run_repopulse_adoption.py" in command
assert "UPGRADE_DEPLOYMENT_CONTROLLER_V2" in command
assert revision in command
assert "--image-id" in command
assert CONTROLLER_VERSION in command
assert "version='2.1.20'" in command
assert "version='2.1.21'" in command
assert "/gitea-repositories/jens/unraid-appops-gateway.git" in command
archive_start = command.index('git --git-dir="$repo" archive')
archive_end = command.index('> "$work/controller.tar"', archive_start)
assert "scripts/vendor" in command[archive_start:archive_end]
assert "scripts/upgrade_deployment_controller.sh > \"$work/controller.tar\"" in command
assert (
'scripts/upgrade_deployment_controller.sh > "$work/controller.tar"' in command
)
assert '--image-id "$image_id"' in command
@@ -110,7 +129,7 @@ def test_controller_promoter_bootstrap_child_spec_binds_legacy_target_identity()
"itworx.controller.promoter": "true",
"itworx.source.repository": "jens/unraid-appops-gateway",
"itworx.source.revision": revision,
"itworx.controller.version": "2.1.20",
"itworx.controller.version": "2.1.21",
"itworx.controller.bootstrap.target.id": target_id,
"itworx.controller.bootstrap.target.image": image_id,
"itworx.controller.bootstrap.target.revision": target_revision,
@@ -142,6 +161,7 @@ def test_controller_promoter_rejects_partial_or_mutable_bootstrap_binding():
current_controller_version="2.1.12",
)
@pytest.mark.parametrize(
"revision,image_id",
[
@@ -151,7 +171,9 @@ def test_controller_promoter_rejects_partial_or_mutable_bootstrap_binding():
("a" * 40, "sha256:" + "z" * 64),
],
)
def test_controller_promoter_rejects_mutable_or_invalid_identity(revision: str, image_id: str):
def test_controller_promoter_rejects_mutable_or_invalid_identity(
revision: str, image_id: str
):
from backend.app.services.controller_artifact_promoter import helper_container_spec
with pytest.raises(ValueError):
@@ -159,7 +181,9 @@ def test_controller_promoter_rejects_mutable_or_invalid_identity(revision: str,
def test_controller_promoter_uses_only_protected_main_and_push_gate():
source = (ROOT / "backend/app/services/controller_artifact_promoter.py").read_text(encoding="utf-8")
source = (ROOT / "backend/app/services/controller_artifact_promoter.py").read_text(
encoding="utf-8"
)
assert 'branch = "main"' in source
assert 'REQUIRED_PUSH_CONTEXT = "Managed validation / full (push)"' in source
assert "controller_promoter_main_not_validated" in source
@@ -167,7 +191,29 @@ def test_controller_promoter_uses_only_protected_main_and_push_gate():
def test_deployment_broker_exposes_bounded_controller_health():
source = (ROOT / "backend/app/services/deployment_broker.py").read_text(encoding="utf-8")
source = (ROOT / "backend/app/services/deployment_broker.py").read_text(
encoding="utf-8"
)
assert "def controller_health(self)" in source
assert 'f"{self.base_url}/health"' in source
assert "_MAX_CONTROLLER_HEALTH_BYTES" in source
def test_modern_promoter_21_binds_actual_installed_19_without_widening_bootstrap_baselines():
from backend.app.services.controller_artifact_promoter import helper_container_spec
actual_revision = "0f89e1506065c5365c48968b1d7845d666a18be8"
spec = helper_container_spec(
revision="a" * 40,
image_id="sha256:" + "b" * 64,
current_controller_id="c" * 64,
current_controller_revision=actual_revision,
current_controller_tree="d" * 40,
current_controller_version="2.1.19",
)
labels = spec["Labels"]
assert labels["itworx.controller.version"] == "2.1.21"
assert labels["itworx.controller.bootstrap.target.revision"] == actual_revision
assert labels["itworx.controller.bootstrap.target.version"] == "2.1.19"
assert labels["itworx.controller.bootstrap.target.id"] == "c" * 64
assert labels["itworx.controller.bootstrap.target.tree"] == "d" * 40