Files
computer-playbook/.github/workflows/test-guide.yml
T
kevinveenbirkenbachandClaude Opus 5 e409674718 refactor(meta): centralize category/distro SPOTs
categories.yml moves from roles/ to the repository-root meta/, joining packages.yml. utils/roles/categories.py owns its location plus the tree-walking helpers that were stranded in entity/name.py, so no caller spells the path or duplicates the lookup.

meta/distros.yml becomes the SPOT for every distribution: os_family, Galaxy platform name, dev-environment base image, and the pkgmgr/pkgmgr-virgin/environment reference templates. It replaces seven scattered copies (DISTRO_FAMILY, VALID_DISTROS, _DISTROS, _CANONICAL_PLATFORMS, two shell arrays, a Makefile literal). INFINITO_DISTROS is no longer a static default but generated by utils/env/handlers/infinito/distros.py; the shell consumers read it through the env layer.

Drops dead CLI surface found along the way: --categories-file and --roles-dir on the provision CLI plus three unused parameters of generate_dynamic_inventory, and the positional roles_file of the invokable categories command.

tests/lint/repository/test_distros_spot.py pins the copies that cannot call the SPOT (workflow literals, docs table) and forbids composing a pkgmgr reference outside it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-28 11:19:30 +02:00

123 lines
4.0 KiB
YAML

name: "📖 Test: Guide"
on:
workflow_call:
inputs:
role:
description: "Role to test; empty picks one at random"
required: false
type: string
default: ""
priority:
description: "Space-separated app ids; a random one is preferred over whitelist"
required: false
type: string
default: ""
whitelist:
description: "Space-separated app ids; a random one is used when no role or priority is given"
required: false
type: string
default: ""
workflow_dispatch:
inputs:
role:
description: "Role to test; empty picks one at random"
required: false
type: string
default: ""
priority:
description: "Space-separated app ids; a random one is preferred over whitelist"
required: false
type: string
default: ""
whitelist:
description: "Space-separated app ids; a random one is used when no role or priority is given"
required: false
type: string
default: ""
permissions:
contents: read
packages: read
jobs:
deploy:
name: 📖 Guide
runs-on: ubuntu-latest
timeout-minutes: 90
env:
INFINITO_IMAGE_TAG: ci-${{ github.sha }}
INFINITO_DISTROS: "arch debian ubuntu fedora centos"
steps:
- if: ${{ !env.ACT }}
uses: actions/checkout@v7.0.0
- name: "📥 Load rescue-diagnostics SPOT into job env"
shell: bash
run: grep '^INFINITO_RESCUE_DIAGNOSTICS_BASE=' default.env >> "$GITHUB_ENV"
- name: 🐍 Install guide + compose deps (Act runner only)
if: ${{ env.ACT }}
shell: bash
run: |
pip install --quiet --break-system-packages pyyaml
apt-get update -qq && apt-get install -y -qq gettext-base jq
- name: 🎲 Select the role, distro, and deploy mode
shell: bash
run: |
set -euo pipefail
python3 -m cli.meta.ci.guide_select \
--role "${{ inputs.role }}" \
--priority "${{ inputs.priority }}" \
--whitelist "${{ inputs.whitelist }}" | tee -a "$GITHUB_ENV"
- name: 🔑 Login to GHCR
if: ${{ !env.ACT }}
uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4.4.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: 🖥️ Install a host role inside its pkgmgr distro container
if: ${{ env.GUIDE_MODE == 'host' }}
shell: bash
run: bash scripts/github/guide/host_deploy.sh
- name: 🖥️ Boot the systemd server for a compose role
if: ${{ env.GUIDE_MODE == 'compose' }}
shell: bash
run: |
set -euo pipefail
INFINITO_IMAGE="$(python3 -m cli.meta.ci.image_ref --kind environment \
--distro "${INFINITO_DISTRO}" \
--owner "$(scripts/meta/resolve/repository/owner.sh)" \
--repository "$(scripts/meta/resolve/repository/name.sh)" \
--tag "ci-${{ github.sha }}")"
echo "INFINITO_IMAGE=${INFINITO_IMAGE}" >> "$GITHUB_ENV"
export INFINITO_IMAGE
make compose-up
- name: 🚀 Deploy the compose role against the server
if: ${{ env.GUIDE_MODE == 'compose' }}
shell: bash
run: bash scripts/github/guide/compose_deploy.sh
- name: 🩺 Collect rescue diagnostics (recursive DiD snapshot)
if: failure()
timeout-minutes: 25
shell: bash
run: |
INFINITO_RESCUE_DIAGNOSTICS_DIR="${INFINITO_RESCUE_DIAGNOSTICS_BASE}/${GUIDE_ROLE}" \
python3 utils/diagnostics/container.py \
"${GUIDE_ROLE}" "guide ${GUIDE_MODE} post-deploy failure" || true
- name: ⬆️ Upload rescue diagnostics
if: ${{ always() && !env.ACT }}
uses: actions/upload-artifact@v7
with:
name: rescue-diagnostics-guide-${{ env.GUIDE_ROLE }}
path: ${{ env.INFINITO_RESCUE_DIAGNOSTICS_BASE }}/
if-no-files-found: ignore