mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-08 19:56:53 +00:00
Every deploy row now takes a node network mode, clearnet, tor or multi, instead of an onion yes or no. The workflow input `network` (auto|clearnet|tor|multi) replaces `tor`, and INFINITO_NETWORK replaces INFINITO_TOR. utils/github/variant/network.py decides which modes a row can take: clearnet only without a Tor bond or when the variant pins Tor off, no multi for a single_mode role, no clearnet for the Tor provider, whose rows are therefore no longer dropped when the rotation lands on clearnet. Priority rows cover every mode and network combination, regular rows rotate the network on sweep // 2, and clearnet rows carry disable=tor. Selection tokens pin the axis with +clearnet, +tor or +multi, and multi rows wear the new glyph. A row hands its mode to the deploy as the variable `network`, which provisioning writes into host_vars as NETWORK_MODE. Without it the node keeps deriving its mode from the deployed providers. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
75 lines
2.7 KiB
Bash
Executable File
75 lines
2.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# Resolve the effective INFINITO_WHITELIST that the discover step should pass to
|
|
# scripts/github/resolve/output_apps.sh, and write it to GITHUB_OUTPUT.
|
|
#
|
|
# Inputs via env:
|
|
# INPUT_WHITELIST caller-provided whitelist (space-separated), as role ids
|
|
# or as the display names utils.roles.display renders. A
|
|
# token may pin deploy axes onto the role
|
|
# (`#variant`, `@mode`, `+network`, see
|
|
# utils.github.variant.selection); the pins are passed
|
|
# through untouched, and only the name in front of them is
|
|
# the directory this checks for.
|
|
# Three cases, in this order of precedence:
|
|
# * "__ALL__" (sentinel, case-insensitive): force
|
|
# full deploy across the workflow's scope. Skips
|
|
# the diff logic and emits an empty whitelist.
|
|
# * any other non-empty value: used verbatim.
|
|
# * empty: trigger the diff-based derivation.
|
|
#
|
|
# Output (GITHUB_OUTPUT):
|
|
# whitelist=<value> effective whitelist. An empty string means
|
|
# "no restriction; deploy everything in scope".
|
|
#
|
|
# Diff logic (only when INPUT_WHITELIST is empty):
|
|
# 1. Run scripts/meta/resolve/diff/affected_roles.sh.
|
|
# 2. If it returns "__ALL__", emit empty whitelist.
|
|
# 3. Otherwise emit the resolved (transitively expanded) role list.
|
|
|
|
set -euo pipefail
|
|
|
|
: "${GITHUB_OUTPUT:?Missing GITHUB_OUTPUT}"
|
|
|
|
# shellcheck source=scripts/meta/env/python.sh
|
|
source scripts/meta/env/python.sh
|
|
|
|
input="${INPUT_WHITELIST:-}"
|
|
input_trimmed="${input//[[:space:]]/}"
|
|
|
|
shopt -s nocasematch
|
|
if [[ "${input_trimmed}" == "__ALL__" ]]; then
|
|
shopt -u nocasematch
|
|
printf 'whitelist=\n' >>"${GITHUB_OUTPUT}"
|
|
echo "Caller forced full deploy via '__ALL__' sentinel."
|
|
exit 0
|
|
fi
|
|
shopt -u nocasematch
|
|
|
|
if [[ -n "${input_trimmed}" ]]; then
|
|
input="$("${PYTHON}" -m utils.roles.display "${input}")"
|
|
unknown=()
|
|
for role in ${input}; do
|
|
[[ -d "roles/${role%%[#@+]*}" ]] || unknown+=("${role}")
|
|
done
|
|
if ((${#unknown[@]})); then
|
|
echo "[ERROR] Unknown role id(s) in the caller-supplied whitelist: ${unknown[*]}" >&2
|
|
echo "[ERROR] They match no directory under roles/, so they would be dropped silently and never deployed." >&2
|
|
exit 1
|
|
fi
|
|
printf 'whitelist=%s\n' "${input}" >>"${GITHUB_OUTPUT}"
|
|
echo "Using caller-supplied whitelist: ${input}"
|
|
exit 0
|
|
fi
|
|
|
|
resolved="$(./scripts/meta/resolve/diff/affected_roles.sh)"
|
|
|
|
if [[ "${resolved}" == "__ALL__" ]]; then
|
|
printf 'whitelist=\n' >>"${GITHUB_OUTPUT}"
|
|
echo "Diff vs origin/main implies full deploy (no whitelist)."
|
|
exit 0
|
|
fi
|
|
|
|
printf 'whitelist=%s\n' "${resolved}" >>"${GITHUB_OUTPUT}"
|
|
echo "Diff-derived whitelist: ${resolved}"
|