mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-29 14:30:52 +00:00
Workers failed 'docker build: no Dockerfile': the build context, compose file, .env and runner binary were staged on the stack host only while every node deploys its own node-local runner stack. Build and push the image once on the manager (RUNNER_IMAGE_REF via the swarm registry, 04_image.yml) and let workers pull it; render compose.yml (template with lstrip_blocks, matching the replaced stack_host_template action), .env and the extracted run.sh on every node. Add a node_local kwarg to the compose_networks/container_networks/compose_restart/compose_only lookups so this node-local compose stack renders a bridge default network (workers cannot create overlays), keeps restart: unless-stopped (ephemeral runners died after one job) and keeps container_name under swarm; default is unchanged for every other role. Treat build/install.stamp as stale when the venv is missing and exclude ./build from the nested-src copy, closing the nested-e2e ruamel failure class. Regression tests for the node_local render paths; the network include tests now accept lookup kwargs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
65 lines
1.8 KiB
Bash
Executable File
65 lines
1.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Install all runtime dependencies, incremental via a stamp file.
|
|
#
|
|
# Re-runs the install chain (dev-python bootstrap -> venv -> python -> ansible)
|
|
# only when a recipe input is newer than the stamp at build/install.stamp.
|
|
# Pass --force (or run `make install-force`) to drop the stamp first.
|
|
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/python.sh
|
|
source "${REPO_ROOT}/scripts/meta/env/python.sh"
|
|
|
|
STAMP="build/install.stamp"
|
|
DEPS=(
|
|
pyproject.toml
|
|
requirements/requirements.galaxy.yml
|
|
requirements/requirements.git.yml
|
|
scripts/install/python.sh
|
|
scripts/install/ansible.sh
|
|
scripts/install/venv.sh
|
|
roles/dev-python/files/install.sh
|
|
)
|
|
|
|
if [[ "${1:-}" == "--force" ]]; then
|
|
rm -f "${STAMP}"
|
|
fi
|
|
|
|
needs_install=0
|
|
if [[ ! -f "${STAMP}" ]]; then
|
|
needs_install=1
|
|
elif [[ ! -x "${VENV}/bin/python" ]]; then
|
|
# Exception: repo copies (docker cp / tar into containers) carry the stamp but not the venv; a stamp without its venv is stale and would silently skip the whole install chain.
|
|
echo "[install] stamp present but venv missing at ${VENV}; reinstalling" >&2
|
|
needs_install=1
|
|
else
|
|
for dep in "${DEPS[@]}"; do
|
|
if [[ ! -f "${dep}" ]]; then
|
|
echo "[install] missing dependency: ${dep}" >&2
|
|
exit 1
|
|
fi
|
|
if [[ "${dep}" -nt "${STAMP}" ]]; then
|
|
needs_install=1
|
|
break
|
|
fi
|
|
done
|
|
fi
|
|
|
|
if [[ "${needs_install}" -eq 0 ]]; then
|
|
exit 0
|
|
fi
|
|
|
|
bash roles/dev-python/files/install.sh ensure
|
|
bash scripts/install/venv.sh
|
|
bash scripts/install/python.sh
|
|
ANSIBLE_COLLECTIONS_DIR="${HOME}/.ansible/collections" bash scripts/install/ansible.sh
|
|
|
|
stamp_dir="$(dirname "${STAMP}")"
|
|
mkdir -p "${stamp_dir}"
|
|
chmod 0777 "${stamp_dir}" 2>/dev/null || true
|
|
touch "${STAMP}"
|
|
chmod 0777 "${STAMP}" 2>/dev/null || true
|