Files
computer-playbook/cli/administration/deploy/development/deps.py
T
kevinveenbirkenbachandClaude Opus 4.7 a77a570409 refactor(env): consolidate INFINITO_* namespace and centralize path/image SPOTs
Closes a stack of env-pipeline regressions left over from the recent
INFINITO_* namespace refactor by:

* DOMAIN_PRIMARY now reads INFINITO_DOMAIN strictly (was: legacy DOMAIN
  env var → defaulted to infinito.localhost, which never resolved
  because CoreDNS serves the INFINITO_DOMAIN value, infinito.example).
* group_vars/all/08_networks.yml IPs (ip4/ip6/dns) now read
  INFINITO_IP4 / INFINITO_IP6 / INFINITO_DNS_IP.
* PLAYWRIGHT_KEEP_ALL renamed to INFINITO_PLAYWRIGHT_KEEP end-to-end
  (env-builder, role default, run_one.yml docker exec, playwright.config.js,
  lint allowlist, docs anchor, CI workflow vars).
* PKGMGR_IMAGE renamed to INFINITO_PARENT_IMAGE; Dockerfile ARG drops
  the inline default so env/default.env is the only SPOT.
* INFINITO_SRC_DIR centralized: Dockerfile ARG (no default) + ENV;
  compose forwards it as build-arg, volume mount path, and container env;
  every Python CLI + shell helper + CI workflow now reads it strictly
  (os.environ[...] / "${INFINITO_SRC_DIR:?...}") instead of the literal
  /opt/src/infinito.
* New entries in env/default.env: INFINITO_IP6=::1, INFINITO_PARENT_IMAGE,
  INFINITO_PLAYWRIGHT_KEEP=false. All three propagated through
  utils/env/handlers/passthrough.STATIC_KEYS and (where consumed in the
  container) through compose.yml's environment block.

Validated end-to-end with `make test` (2360 tests across lint, lint-*,
test-lint, test-external, test-unit, test-integration).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 02:30:34 +02:00

64 lines
1.9 KiB
Python

from __future__ import annotations
import os
from typing import TYPE_CHECKING
if TYPE_CHECKING:
# Import only for type checking to avoid runtime import cycles.
from .compose import Compose
def resolve_run_after(
compose: Compose,
role_name: str,
*,
services_overrides_container_path: str | None = None,
) -> list[str]:
"""
Calls resolver inside the infinito container:
python -m cli.meta.roles.applications.resolution.combined <role_name>
[--services-overrides <path-inside-container>]
`services_overrides_container_path` is the in-container path to a
JSON file `{role_name: services_map}` whose entries replace each
listed role's `meta/services.yml` for the resolver. Callers
(variant-aware planner) write the file to a path that is shared
with the container before calling.
"""
cmd = [
"python3",
"-m",
"cli.meta.roles.applications.resolution.combined",
role_name,
]
if services_overrides_container_path:
cmd.extend(["--services-overrides", services_overrides_container_path])
r = compose.exec(
cmd, check=False, workdir=os.environ["INFINITO_SRC_DIR"], capture=True
)
if r.returncode != 0:
raise RuntimeError(
f"resolution.combined 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.
"""
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