Files
computer-playbook/scripts/meta/env/defaults.sh
T
kevinveenbirkenbachandClaude Opus 4.7 3e31630d58 fix(ci/deploy)+refactor(cli/deploy/development): single-SPOT INFINITO_DISTRO/INFINITO_CONTAINER
Two related improvements anchored on the same principle: the env var
INFINITO_DISTRO is the single source of truth for the development distro,
and INFINITO_CONTAINER is purely derived from it.

1. Fix the matrix-deploy purge failure (CI run 24942172018, job 73038526513,
   web-app-wordpress @ fedora):
   scripts/meta/env/defaults.sh eager-exported INFINITO_CONTAINER once
   inside its load-once guard; ci/all.sh's iteration loop re-exported
   INFINITO_DISTRO per round but the cached INFINITO_CONTAINER stayed at
   the initial-default infinito_nexus_debian, so _purge_app_entities()
   between rounds tried to docker exec into a container from the wrong
   distro and failed with "No such container".

   Move the INFINITO_CONTAINER derivation OUTSIDE the load-once guard so
   every re-source picks up a CONTAINER name in lock-step with the current
   INFINITO_DISTRO. ci/all.sh now re-sources defaults.sh after each
   export INFINITO_DISTRO=\$distro to trigger that re-derivation. defaults.sh
   stays the single spot that owns the formula.

2. Retire the --distro CLI arg from cli.deploy.development {up,down,stop,
   restart,init,deploy,exec,logs,build}. The arg duplicated INFINITO_DISTRO
   (its default already read from the env), creating a hidden second source
   of truth that drifted from the env across matrix iterations. Replace it
   with cli.deploy.development.common.resolve_distro() which reads
   INFINITO_DISTRO strictly (raises SystemExit on unset/invalid), and
   simplify make_compose() to take no args. All bash callers
   (scripts/tests/deploy/{ci,local}/**, Makefile restart target) drop the
   redundant --distro \"\${INFINITO_DISTRO}\" pass-through.

Verified: make test passes (1553 unit + 168 integration). The mechanism of
the WP fix is verified by a synthetic distro-cycling test of defaults.sh
re-derivation; the original CI multi-distro repro can only be confirmed
end-to-end by the next CI push (local single-distro deploys do not exercise
the stale-env path).

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

33 lines
1.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# shellcheck shell=bash
#
# Resolve project default values.
set -euo pipefail
# INFINITO_CONTAINER is fully derived from the current INFINITO_DISTRO. This
# block runs OUTSIDE the load-once guard below so callers that re-export
# INFINITO_DISTRO between matrix iterations (e.g. scripts/tests/deploy/ci/all.sh)
# can re-source defaults.sh and pick up a CONTAINER name in lock-step. Without
# this, the original eager-export only fired on the first source and stuck at
# infinito_nexus_debian even after later iterations exported a different
# INFINITO_DISTRO — see the failure on web-app-wordpress @ fedora in CI run
# 24942172018 / job 73038526513.
: "${INFINITO_DISTRO:=debian}"
export INFINITO_DISTRO
export INFINITO_CONTAINER="infinito_nexus_${INFINITO_DISTRO}"
if [[ "${INFINITO_ENV_DEFAULTS_LOADED:-}" == "1" ]]; then
return 0
fi
export INFINITO_ENV_DEFAULTS_LOADED="1"
: "${TEST_DEPLOY_TYPE:=server}"
export TEST_DEPLOY_TYPE
: "${TEST_PATTERN:=test*.py}"
export TEST_PATTERN
: "${DISTROS:=arch debian ubuntu fedora centos}"
export DISTROS