mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 19:01:54 +00:00
`cli build include` generated one tasks/groups/<group>-roles.yml per invokable category during setup, and the stage plays included those files. They were written by the in-container UID, which is why a dedicated clean-container-owned helper had to delete them from inside the container.
The stage plays now loop over lookup('group_roles', <group>) and include tasks/utils/setup/{group,role}.yml directly. ordered_roles() in utils/roles/order.py holds the run_after topological sort the generator used to perform at build time.
utils/roles/stage.py:_group_names() no longer globs the generated files; it reads get_invokable_paths(), the same categories.yml source those files were derived from.
Measured: handlers still flush after every role (ansible-core 2.20.2, three loop items, three separate handler runs), and resolving all 18 groups costs 0.60s cold against 1.4s for the generator.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
39 lines
1.5 KiB
Bash
Executable File
39 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Remove the container-owned generated artefacts under the working tree.
|
|
#
|
|
# `build/` (install-stamp) is produced inside the compose container by
|
|
# the in-container UID (typically `nobody`). The host
|
|
# user cannot rm them directly. This helper starts the infinito
|
|
# compose container if a stopped one exists, then deletes the
|
|
# nobody-owned artefacts from inside it. Safe no-op when the targets
|
|
# do not exist.
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
REPO_ROOT="$(cd "${SCRIPT_DIR}/../../.." && pwd)"
|
|
cd "${REPO_ROOT}"
|
|
|
|
# shellcheck source=scripts/meta/env/load.sh
|
|
source scripts/meta/env/load.sh
|
|
|
|
: "${INFINITO_CONTAINER:?INFINITO_CONTAINER not set after sourcing load.sh}"
|
|
: "${INFINITO_SRC_DIR:?INFINITO_SRC_DIR not set after sourcing load.sh}"
|
|
|
|
if ! docker ps --filter "name=${INFINITO_CONTAINER}" --format '{{.Names}}' | grep -q .; then
|
|
if docker ps -a --filter "name=${INFINITO_CONTAINER}" --format '{{.Names}}' | grep -q .; then
|
|
echo "[clean-container-owned] starting stopped container ${INFINITO_CONTAINER}"
|
|
docker start "${INFINITO_CONTAINER}" >/dev/null
|
|
else
|
|
echo "[clean-container-owned] no ${INFINITO_CONTAINER} container exists — nothing to clean" >&2
|
|
exit 0
|
|
fi
|
|
fi
|
|
|
|
echo "[clean-container-owned] removing container-owned generated artefacts inside ${INFINITO_CONTAINER}"
|
|
docker exec -i "${INFINITO_CONTAINER}" sh -lc "
|
|
set -eu
|
|
cd '${INFINITO_SRC_DIR}'
|
|
rm -rf build
|
|
"
|
|
echo "[clean-container-owned] done"
|