mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 19:01:54 +00:00
Replace 8 bash env modules with a single Python generator
(cli.meta.env) that materialises env/static.env + runtime context
into a gitignored .env. Each variable lives in its own handler
under utils/env/handlers/; defaults carry inline one-line `# ...`
comments.
Rename to the INFINITO_* schema:
- workflow inputs: APPS, SERVICES_DISABLED, CMD, DEBUG, WHITELIST,
BUNDLES, FULL_CYCLE, VARIANT, RUN_FLAGS, LIMIT_HOST, PARALLEL
- inventory: INVENTORY_DIR / INVENTORY_FILE / HOST_VARS_FILE,
PW_FILE -> INVENTORY_PASSWORD_FILE
- venv: VENV_BASE / VENV_FALLBACK / VENV_NAME
- new SPOT defaults: COMPILE_SILENCE, CONTAINER_NO_CA,
WAIT_HEALTH_TIMEOUT_S, PACKAGE_CACHE_FRONTEND_INIT_IMAGE,
promoted IMAGE_TAG from GHA-only to general passthrough
compose.yml hardening:
- inline \${VAR:-default} removed; strict \${VAR:?...} everywhere
- new integration lint blocks regressions
Tooling:
- scripts/install/all.sh owns the stamp-file install logic
(Makefile target delegates)
- scripts/meta/env/load.sh is the single shell entry point;
8 bash modules deleted
- new shell lint: no INFINITO_* defaults outside env/static.env
Tests:
- 93 new unit tests for utils/env/{builder,parser,runtime,writer}
- restructure tests/lint into repository/ (file-content rules) vs
filesystem/{shell,python,env}/ (filesystem-shape rules)
- drift + smoke integration tests against the generator
Docs:
- variables.md is now a pointer; per-variable docs live next to
the key in env/static.env / env/ci.env
- compose.yml.md drops the Default column
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
87 lines
2.2 KiB
Bash
Executable File
87 lines
2.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# Retag already built CI images (ci-<sha>) to <version> and, for the highest
|
|
# version only, to latest as well (no rebuild).
|
|
|
|
OWNER="${OWNER:-${GITHUB_REPOSITORY_OWNER:-}}"
|
|
OWNER="$(OWNER="${OWNER}" GITHUB_REPOSITORY_OWNER="${GITHUB_REPOSITORY_OWNER:-}" GITHUB_REPOSITORY="${GITHUB_REPOSITORY:-}" scripts/meta/resolve/repository/owner.sh)"
|
|
[[ -n "${OWNER}" ]] || {
|
|
echo "ERROR: OWNER not set"
|
|
exit 2
|
|
}
|
|
|
|
REGISTRY="${REGISTRY:-ghcr.io}"
|
|
: "${REPO_PREFIX:?Missing REPO_PREFIX}"
|
|
: "${INFINITO_DISTROS:?Missing INFINITO_DISTROS}"
|
|
DEFAULT_DISTRO="${DEFAULT_DISTRO:-debian}"
|
|
PUBLISH_LATEST="${PUBLISH_LATEST:-true}"
|
|
REPO_PREFIX="${REPO_PREFIX,,}"
|
|
|
|
# VERSION_TAG must be like "v1.2.3"
|
|
VERSION_TAG="${VERSION_TAG:-${GITHUB_REF_NAME:-}}"
|
|
[[ -n "${VERSION_TAG}" ]] || {
|
|
echo "ERROR: VERSION_TAG not set"
|
|
exit 2
|
|
}
|
|
|
|
# CI_TAG should be "ci-<sha>"
|
|
CI_TAG="${CI_TAG:-ci-${GITHUB_SHA:-}}"
|
|
[[ -n "${CI_TAG}" ]] || {
|
|
echo "ERROR: CI_TAG not set"
|
|
exit 2
|
|
}
|
|
|
|
echo "Retagging CI images:"
|
|
echo " CI_TAG = ${CI_TAG}"
|
|
echo " VERSION_TAG = ${VERSION_TAG}"
|
|
echo " INFINITO_DISTROS = ${INFINITO_DISTROS}"
|
|
echo " PUBLISH_LATEST = ${PUBLISH_LATEST}"
|
|
|
|
retag_set() {
|
|
local src="$1"
|
|
local dst_ver="$2"
|
|
local dst_latest="${3:-}"
|
|
local args=()
|
|
|
|
echo " source: ${src}"
|
|
echo " target: ${dst_ver}"
|
|
args+=(-t "${dst_ver}")
|
|
|
|
if [[ -n "${dst_latest}" ]]; then
|
|
echo " target: ${dst_latest}"
|
|
args+=(-t "${dst_latest}")
|
|
fi
|
|
|
|
docker buildx imagetools create \
|
|
"${args[@]}" \
|
|
"${src}"
|
|
}
|
|
|
|
for distro in ${INFINITO_DISTROS}; do
|
|
echo
|
|
echo "==> ${distro}"
|
|
|
|
# NORMAL
|
|
src="${REGISTRY}/${OWNER}/${REPO_PREFIX}/${distro}:${CI_TAG}"
|
|
dst_ver="${REGISTRY}/${OWNER}/${REPO_PREFIX}/${distro}:${VERSION_TAG}"
|
|
dst_latest=""
|
|
if [[ "${PUBLISH_LATEST}" == "true" ]]; then
|
|
dst_latest="${REGISTRY}/${OWNER}/${REPO_PREFIX}/${distro}:latest"
|
|
fi
|
|
retag_set "${src}" "${dst_ver}" "${dst_latest}"
|
|
|
|
# Alias for default distro
|
|
if [[ "${distro}" == "${DEFAULT_DISTRO}" ]]; then
|
|
alias_ver="${REGISTRY}/${OWNER}/${REPO_PREFIX}:${VERSION_TAG}"
|
|
alias_latest=""
|
|
if [[ "${PUBLISH_LATEST}" == "true" ]]; then
|
|
alias_latest="${REGISTRY}/${OWNER}/${REPO_PREFIX}:latest"
|
|
fi
|
|
retag_set "${src}" "${alias_ver}" "${alias_latest}"
|
|
fi
|
|
done
|
|
|
|
echo
|
|
echo "Done retagging CI images."
|