mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 19:01:54 +00:00
CI deploy jobs were titled with the raw role id, so a run page read as a
column of dash-joined prefixes. They now carry a display name: the category
path as hanzi labels, then the role's README heading or the part of the id
the categories do not already say, whichever is shorter.
utils/roles/display.py owns both directions. Encoding happens once, at
discovery time, as a `label` key on every matrix entry; the workflows render
`<glyph> ${{ matrix.label }}` and keep the glyph as a literal because the
retrigger reads the deploy mode off it.
Decoding is what makes the retrigger keep working. It accepts a display name
with or without its variant shard and a bare role id unchanged, so job names
from runs that predate this still parse and a hand-typed dispatch never has
to spell hanzi. The parser therefore stopped matching an id-shaped tail and
asks the codec instead; a job the codec does not recognise is skipped rather
than counted as a role.
The role selections go out as display names too, so the run title reads like
the jobs it spawns. Four consumers decode them back, each the single place
the value is actually used: the whitelist resolver before it checks the role
directory, the discovery query on its env, and the sequencing and plan CLIs
on their arguments.
Every fragment is joined by `·`, including before the title, and the heading
loses its whitespace and any emoji variation selector. A display name holding
a space would make the space-separated whitelist and priority inputs
unparseable with more than one role.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
70 lines
2.4 KiB
Bash
Executable File
70 lines
2.4 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.
|
|
# 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}"
|