Files
computer-playbook/scripts/tests/deploy/utils/filesystem/pick.sh
T
kevinveenbirkenbachandClaude Opus 5 66bde6af40 feat(ci): spread distro and filesystem per row
A run-wide draw proved one distribution and said nothing about the other four, while reporting green. Both are matrix-row axes now, assigned by the same deterministic rotation mode and tor already use, so one sweep exercises every distribution and every filesystem.

The two read the row's position like an odometer, the distro as the low digit. Turning both on the position directly covers only n of the n x m pairs whenever the pools are the same length, and no sweep unlocks it.

Both are part of a row's identity: glyphs in the job label, columns in the plan table, shards in the artifact name. Both are selectable through %distro and /filesystem, and a retrigger replays the distro off a failed title. It leaves the filesystem out, because a title states the kind the matrix assigned and a deploy may have fallen back from it.

A row's filesystem is a preference unless a human names it, on the run or in a token. Reading the matrix's own narrowing as a demand would fail rows for every transient condition the applying step is built to tolerate.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-20 14:23:29 +02:00

60 lines
2.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# Settle the docker data-root filesystem for the deploy in progress and leave the
# decision in the calling shell's environment.
#
# Sourced rather than executed: resolve.sh hands its answer over a file in the
# GITHUB_ENV format, and the caller needs those values in its own environment,
# so the answer is routed through a temporary file of that format and sourced
# back.
#
# Nothing is drawn outside GitHub Actions, and nothing is drawn for the runner
# scope under act, which shares the developer's docker daemon: repointing its
# data root would take their local images with it. The node scope still draws
# under act, because those containers are the lab's own and are thrown away with
# it. A caller that gets no pick finds INFINITO_DOCKER_FILESYSTEM empty and
# leaves the data root where it is. Skipping therefore clears both keys rather
# than leaving them alone: they are declared in default.env, so a generated .env
# carries whatever was exported when it was made, and a caller gating its apply
# on the value would otherwise act on a stale pick - on the developer's own
# docker, in the very case the skip exists to protect.
#
# Reads:
# INFINITO_DOCKER_FILESYSTEM_ALLOWED space-separated subset of
# 'ext4 btrfs zfs' the run permits;
# empty permits all three
# INFINITO_DOCKER_FILESYSTEM_PICK the kind the matrix assigned this row
# INFINITO_DOCKER_FILESYSTEM_ENFORCED 'true' when a human named that kind, so
# a host that cannot deliver it fails
# INFINITO_DISTRO distro under test, recorded with the pick
# Param: $1 label the pick belongs to, e.g. compose/web-app-gitea/debian
# Param: $2 scope the pick gets applied in, runner or node
filesystem_pick() {
local label="$1" scope="$2" answer resolver
if [ -z "${GITHUB_ACTIONS:-}" ] ||
{ [ -n "${ACT:-}" ] && [ "${scope}" = runner ]; }; then
INFINITO_DOCKER_FILESYSTEM=""
INFINITO_DOCKER_FILESYSTEM_REQUIRED=""
export INFINITO_DOCKER_FILESYSTEM INFINITO_DOCKER_FILESYSTEM_REQUIRED
echo "filesystem: no pick for the ${scope} here, leaving its data root alone"
return 0
fi
resolver="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/resolve.sh"
answer="$(mktemp)"
GITHUB_ENV="${answer}" bash "${resolver}" \
"${INFINITO_DOCKER_FILESYSTEM_ALLOWED:-}" \
"${label}" \
"${INFINITO_DISTRO:-}" \
"${scope}" \
"${INFINITO_DOCKER_FILESYSTEM_ENFORCED:-}" \
"${INFINITO_DOCKER_FILESYSTEM_PICK:-}"
set -a
# shellcheck source=/dev/null
. "${answer}"
set +a
rm -f "${answer}"
}