mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-12 21:56:21 +00:00
Follow-up to d002796a5. The formula `infinito_nexus_${INFINITO_DISTRO}` is
now defined in exactly one place — `scripts/meta/env/defaults.sh:18`,
exported outside the load-once guard so it tracks INFINITO_DISTRO across
matrix iterations (caller re-sources defaults.sh after distro changes).
Every other site reads INFINITO_CONTAINER strictly from env; nothing
re-derives the formula, no lazy/colon-dash fallbacks, no per-call defaults.
Production code aligned:
- cli/deploy/development/common.py: add resolve_container() (strict env
reader, raises SystemExit on unset). make_compose() calls it as an
early-fail guard so a missing defaults.sh source surfaces here instead
of as a confusing compose.yml interpolation error later.
- cli/deploy/development/deploy.py: stop re-deriving from compose.distro;
use resolve_container().
- compose.yml: container_name reads ${INFINITO_CONTAINER:?...} strictly,
so callers that bypass defaults.sh fail fast with a clear hint.
- scripts/meta/resolve/image/local.sh: drop ${INFINITO_DISTRO:-debian}
fallback; require INFINITO_DISTRO via :? error.
- scripts/tests/deploy/ci/dedicated.sh: drop local _container fallback.
- scripts/tests/deploy/local/deploy/fresh-kept-app.sh: drop redundant
${INFINITO_DISTRO:-debian} reassignment after sourcing env/all.sh
(defaults.sh already defaults the value).
- scripts/tests/deploy/local/deploy/fresh-purged-app.sh: drop
target_container fallback; INFINITO_CONTAINER is already in env.
- scripts/tests/deploy/local/exec/container.sh: drop the lazy
${INFINITO_CONTAINER:=infinito_nexus_...} default; defaults.sh source
in env/all.sh already guarantees the value.
- scripts/tests/dns.sh: source defaults.sh so callers only need to set
INFINITO_DISTRO (the implicit dependency was previously a footgun).
- scripts/system/tls/trust/{wsl2,linux}.sh: same — source defaults.sh,
drop the ${INFINITO_CONTAINER:-infinito_nexus_debian} fallback in
linux.sh.
- .github/workflows/test-dns.yml: drop redundant
INFINITO_CONTAINER: infinito_nexus_${{ matrix.distro }} from per-step
env blocks (3 sites). The env now flows from INFINITO_DISTRO via the
defaults.sh sourced inside the scripts.
- tests/unit/cli/deploy/development/test_matrix_deploy.py: replace the
module-level os.environ.setdefault('INFINITO_CONTAINER', 'infinito_nexus_arch')
shim — which itself encoded the formula — with a module-level patch of
resolve_container that returns an opaque test-fixture string. Drop the
now-unused distro="arch" field from the _args() Namespace fixture
(deploy.handler stopped consuming it after the --distro arg removal).
Documentation aligned:
- docs/contributing/environment/variables.md: rewrite the INFINITO_CONTAINER
row to spell out the SPOT contract — set automatically by defaults.sh,
never re-derived elsewhere, callers re-source defaults.sh after
changing INFINITO_DISTRO mid-process.
- docs/contributing/artefact/files/compose.yml.md: replace the
INFINITO_DISTRO row (which described the now-removed
`infinito_nexus_${INFINITO_DISTRO:-debian}` interpolation) with an
INFINITO_CONTAINER row noting the strict ${INFINITO_CONTAINER:?...} read.
Verified:
- Formula derivation: 1 production hit (the SPOT in defaults.sh:18).
- INFINITO_CONTAINER fallback patterns (:-/:=): 0.
- --distro CLI arg refs: 0 (one comment explaining the removal).
- make test green: 1553 unit + 168 integration tests, no skipped suites.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
124 lines
3.3 KiB
YAML
124 lines
3.3 KiB
YAML
name: "💬 Test: DNS"
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
distros:
|
|
description: "Space-separated distro list (e.g. 'arch debian ubuntu')"
|
|
required: false
|
|
default: "debian"
|
|
type: string
|
|
|
|
workflow_call:
|
|
inputs:
|
|
distros:
|
|
description: "Space-separated distro list"
|
|
required: true
|
|
type: string
|
|
|
|
permissions:
|
|
contents: read
|
|
packages: read
|
|
|
|
env:
|
|
INFINITO_IMAGE_TAG: ci-${{ github.sha }}
|
|
|
|
jobs:
|
|
prepare:
|
|
name: 🧮 Build matrix
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
matrix: ${{ steps.out.outputs.matrix }}
|
|
owner: ${{ steps.vars.outputs.owner }}
|
|
repo_name: ${{ steps.vars.outputs.repo_name }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Resolve image coordinates
|
|
id: vars
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
owner="$(scripts/meta/resolve/repository/owner.sh)"
|
|
repo_name="${{ github.repository }}"
|
|
repo_name="${repo_name#*/}"
|
|
repo_name="${repo_name,,}"
|
|
echo "owner=${owner}" >> "$GITHUB_OUTPUT"
|
|
echo "repo_name=${repo_name}" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Install jq
|
|
shell: bash
|
|
run: ./scripts/install/apt.sh jq
|
|
|
|
- name: Compute matrix JSON
|
|
id: out
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
distros="${{ inputs.distros }}"
|
|
distros="${distros:-debian}"
|
|
json="$(printf '%s' "${distros}" | jq -Rc 'split(" ") | map(select(length>0))')"
|
|
echo "matrix=${json}" >> "$GITHUB_OUTPUT"
|
|
echo "Using matrix: ${json}"
|
|
|
|
dns:
|
|
name: 🌐 Test DNS (${{ matrix.distro }})
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
needs: prepare
|
|
env:
|
|
NIX_CONFIG: |
|
|
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
|
|
INFINITO_IMAGE_TAG: ci-${{ github.sha }}
|
|
# Use the prebuilt CI image directly instead of the :latest fallback from env/all.sh.
|
|
INFINITO_IMAGE: ghcr.io/${{ needs.prepare.outputs.owner }}/${{ needs.prepare.outputs.repo_name }}/${{ matrix.distro }}:ci-${{ github.sha }}
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
distro: ${{ fromJson(needs.prepare.outputs.matrix) }}
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Install dnsutils (dig)
|
|
shell: bash
|
|
run: ./scripts/install/apt.sh dnsutils
|
|
|
|
- name: Start stack (coredns + infinito) for distro
|
|
shell: bash
|
|
env:
|
|
INFINITO_DISTRO: ${{ matrix.distro }}
|
|
run: |
|
|
set -euo pipefail
|
|
make up
|
|
|
|
- name: DNS test suite
|
|
shell: bash
|
|
env:
|
|
ENV_FILE: env.ci
|
|
INFINITO_DISTRO: ${{ matrix.distro }}
|
|
run: |
|
|
set -euo pipefail
|
|
scripts/tests/dns.sh
|
|
|
|
- name: Dump CoreDNS logs on failure
|
|
if: failure()
|
|
shell: bash
|
|
run: |
|
|
docker ps -a || true
|
|
docker logs infinito-coredns --tail=200 || true
|
|
|
|
- name: Dump infinito logs on failure
|
|
if: failure()
|
|
shell: bash
|
|
env:
|
|
INFINITO_DISTRO: ${{ matrix.distro }}
|
|
run: |
|
|
set -euo pipefail
|
|
# shellcheck source=scripts/meta/env/defaults.sh
|
|
source scripts/meta/env/defaults.sh
|
|
docker logs "${INFINITO_CONTAINER}" --tail=200 || true
|