Files
computer-playbook/cli/deploy/test/deps.py
T
kevinveenbirkenbach dba121ecf4 refactor(ci): move deploy test runner from bash to python orchestrator
* Add `cli.deploy.test` module to orchestrate compose-based CI deploy tests
* Support server per-app runs (including run_after dependencies) and workstation selection
* Add optional image build flags (--no-cache, --missing) and stack retention on failure
* Simplify `scripts/tests/deploy.sh` to a thin wrapper that forwards args to the Python runner

https://chatgpt.com/share/695f9e22-6e9c-800f-9a50-65f553619af2
2026-01-08 13:07:57 +01:00

39 lines
1.2 KiB
Python

from __future__ import annotations
import subprocess
def resolve_run_after(role_name: str) -> list[str]:
"""
Calls your existing resolver:
python -m cli.meta.applications.run_after_resolution <role_name>
Returns a list of role folder names (e.g., web-app-foo web-svc-bar ...)
"""
cmd = ["python3", "-m", "cli.meta.applications.run_after_resolution", role_name]
r = subprocess.run(cmd, text=True, capture_output=True)
if r.returncode != 0:
raise RuntimeError(
f"run_after_resolution failed for {role_name} (rc={r.returncode})\n"
f"STDOUT:\n{r.stdout}\nSTDERR:\n{r.stderr}"
)
txt = (r.stdout or "").strip()
if not txt:
return []
return [t for t in txt.split() if t.strip()]
def apps_with_deps(app_id: str, deps_role_names: list[str]) -> list[str]:
"""
The resolver returns role folder names. In your current inventory groups,
group names == application_ids (folder names). So we can include them directly.
"""
# ensure prerequisites first + app_id last
out: list[str] = []
for d in deps_role_names:
if d != app_id and d not in out:
out.append(d)
if app_id not in out:
out.append(app_id)
return out