mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-10 04:36:40 +00:00
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>
81 lines
2.2 KiB
Bash
Executable File
81 lines
2.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# Open an interactive shell in the running infinito container, or execute a
|
|
# one-off command inside it when INFINITO_CMD or positional arguments are set.
|
|
#
|
|
# Usage:
|
|
# scripts/tests/deploy/local/exec/container.sh [command...] # nocheck: self-path-reference
|
|
#
|
|
# Environment:
|
|
# INFINITO_DISTRO arch|debian|ubuntu|fedora|centos
|
|
# INFINITO_CONTAINER Optional explicit container name
|
|
# INFINITO_CMD One-off shell command to run instead of an interactive shell
|
|
#
|
|
# Examples:
|
|
# scripts/tests/deploy/local/exec/container.sh whoami # nocheck: self-path-reference
|
|
# INFINITO_CMD='whoami && id' scripts/tests/deploy/local/exec/container.sh # nocheck: self-path-reference
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
REPO_ROOT="$(cd "${SCRIPT_DIR}/../../../../../" && pwd)"
|
|
|
|
usage() {
|
|
cat <<EOF
|
|
Usage:
|
|
${0}
|
|
${0} [command...]
|
|
|
|
Environment:
|
|
INFINITO_DISTRO arch|debian|ubuntu|fedora|centos
|
|
INFINITO_CONTAINER Optional explicit container name
|
|
INFINITO_CMD One-off shell command to run instead of an interactive shell
|
|
|
|
Examples:
|
|
${0}
|
|
${0} whoami
|
|
INFINITO_CMD='whoami && id' ${0}
|
|
EOF
|
|
}
|
|
|
|
if [[ "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then
|
|
usage
|
|
exit 0
|
|
fi
|
|
|
|
cd "${REPO_ROOT}"
|
|
|
|
if [[ -f "scripts/meta/env/load.sh" ]]; then
|
|
# shellcheck source=scripts/meta/env/load.sh
|
|
source "scripts/meta/env/load.sh"
|
|
else
|
|
echo "ERROR: missing scripts/meta/env/load.sh" >&2
|
|
exit 2
|
|
fi
|
|
|
|
# defaults.sh exports INFINITO_CONTAINER from INFINITO_DISTRO (single SPOT
|
|
# for the formula). Read strictly here — no local re-derivation.
|
|
: "${INFINITO_CONTAINER:?INFINITO_CONTAINER not set after sourcing scripts/meta/env/load.sh — bug in defaults.sh?}"
|
|
container="${INFINITO_CONTAINER}"
|
|
|
|
docker_exec_flags=(-i)
|
|
if [[ -t 0 && -t 1 ]]; then
|
|
docker_exec_flags=(-it)
|
|
fi
|
|
|
|
if [[ $# -gt 0 ]]; then
|
|
if [[ "${1:-}" == "--" ]]; then
|
|
shift
|
|
fi
|
|
if [[ $# -eq 0 ]]; then
|
|
usage
|
|
exit 2
|
|
fi
|
|
exec docker exec "${docker_exec_flags[@]}" -w "${INFINITO_SRC_DIR}" "${container}" "$@"
|
|
fi
|
|
|
|
if [[ -n "${INFINITO_CMD:-}" ]]; then
|
|
exec docker exec "${docker_exec_flags[@]}" -w "${INFINITO_SRC_DIR}" "${container}" sh -lc "${INFINITO_CMD}"
|
|
fi
|
|
|
|
exec docker exec "${docker_exec_flags[@]}" -w "${INFINITO_SRC_DIR}" "${container}" sh
|