mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 19:01:54 +00:00
The env.development marker file existed for two purposes that no longer justify the wiring cost: a per-machine compose --env-file override layer appended after auto-loaded .env, and a fallback signal for detect_runtime() to return "dev" when the marker exists. With every INFINITO_* default now collapsed into env/default.env -> .env, persistent per-machine overrides are best expressed as \`export INFINITO_FOO=…\` before invoking make (load.sh honors caller-set values via setdefault). The marker fallback in detect_runtime was redundant with the explicit RUNTIME=dev that every dev-flow callsite already passes (fresh-*.sh, reset/inventory.sh). Removed: - Makefile mark-development target + .PHONY entry - env.development from .gitignore / .dockerignore - env_local conditional in compose.up() - env_development conditional in down._compose_run() - env.development conditional in scripts/meta/resolve/apps.sh and scripts/meta/resolve/diff/affected_roles.sh - env.development marker branch + the now-unused project_root parameter from cli/meta/runtime/detect_runtime; __main__.py caller follows - "Optional Development Marker" section in docs/contributing/environment/ setup.md and the marker reference in docs/administration/installation.md Also drops two RUNTIME=='dev' guards in roles/web-app-bigbluebutton that relied on the auto-detect path: - the compose build etherpad task in tasks/02_compose.yml - the freeswitch iptables-REJECT entrypoint override in templates/compose.override.yml.j2 With auto-detection of "dev" gone the guards would otherwise only fire on explicit RUNTIME=dev runs, silently regressing the local-dev path operators rely on; both behaviors now apply unconditionally. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
45 lines
1.1 KiB
Python
45 lines
1.1 KiB
Python
from __future__ import annotations
|
|
|
|
import os
|
|
from pathlib import Path
|
|
|
|
PROJECT_ROOT: Path = Path(__file__).resolve().parents[3]
|
|
|
|
|
|
def detect_runtime() -> str:
|
|
"""
|
|
Detect the current execution runtime.
|
|
|
|
Returns the value of the ``RUNTIME`` env var when set (callers pass
|
|
e.g. ``"dev"`` here to flag a local development compose run), or one
|
|
of the auto-detected labels otherwise:
|
|
|
|
- "act" : local GitHub Actions emulation (act)
|
|
- "github" : real GitHub Actions runner
|
|
- "host" : native host execution (default)
|
|
|
|
Precedence:
|
|
1) RUNTIME (explicit override)
|
|
2) act (must come before github because act sets GITHUB_ACTIONS=true)
|
|
3) github
|
|
4) host
|
|
"""
|
|
# 1) explicit override wins
|
|
v = (os.getenv("RUNTIME") or "").strip()
|
|
if v:
|
|
return v
|
|
|
|
# 2) act (must be before GitHub)
|
|
if os.getenv("ACT") == "true" or os.getenv("ACT_RUNNER"):
|
|
return "act"
|
|
|
|
# 3) GitHub Actions
|
|
if (
|
|
os.getenv("GITHUB_ACTIONS") == "true"
|
|
or os.getenv("INFINITO_RUNNING_ON_GITHUB") == "true"
|
|
):
|
|
return "github"
|
|
|
|
# 4) default
|
|
return "host"
|