mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-29 22:37:29 +00:00
The rescue path was built from two workflow env interpolations, and neither name exists in the job env block - both are written to $GITHUB_ENV at runtime. An undefined expression expands to the empty string, so the path became "" + "/" + "" = literally /. The steps that use it run under if: failure() and if: always(), i.e. exactly when the writing step did not finish. The grep cannot fail: default.env is tracked and carries the value. What made it unreachable was sitting behind a python3 call in the same step, which aborts under set -e before the redirect group runs. Split it out, the way the four sibling workflows have always done it, and let the diagnostics step build its own path with :? so a missing value is loud rather than a walk of /. Verified under act with every variable forced empty: the old shape yields DIR=[/] and a passing [ -d / ]; the new one keeps the paths across the failing distro step and leaves INFINITO_DISTRO unset. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
139 lines
4.5 KiB
YAML
139 lines
4.5 KiB
YAML
name: "💻 Test: Workspace"
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
workflow_call:
|
|
|
|
permissions:
|
|
actions: write
|
|
contents: read
|
|
packages: read
|
|
|
|
jobs:
|
|
prepare:
|
|
name: 📋 Workspace Matrix
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 5
|
|
outputs:
|
|
images: ${{ steps.matrix.outputs.images }}
|
|
|
|
steps:
|
|
- name: ⬇️ Checkout repository
|
|
uses: actions/checkout@v7.0.0
|
|
|
|
- name: 🐍 Read the distro SPOT
|
|
id: matrix
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
images="$(python3 -m cli.meta.ci.dev_runtime images)"
|
|
echo "images=${images}" | tee -a "$GITHUB_OUTPUT"
|
|
|
|
test-workspace:
|
|
name: 🧑💻 Workspace (${{ matrix.dev_runtime_image }})
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 345
|
|
needs: prepare
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
dev_runtime_image: ${{ fromJson(needs.prepare.outputs.images) }}
|
|
|
|
env:
|
|
DEV_RUNTIME_IMAGE: ${{ matrix.dev_runtime_image }}
|
|
NIX_CONFIG: |
|
|
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
|
|
INFINITO_CACHE_REGISTRY_MAX_SIZE: 16g
|
|
INFINITO_CACHE_REGISTRY_HOST_PATH: /mnt/cache/registry/mirror
|
|
INFINITO_CACHE_REGISTRY_CA_HOST_PATH: /mnt/cache/registry/ca
|
|
INFINITO_CACHE_PACKAGE_BLOBSTORE_MAX: 8g
|
|
INFINITO_CACHE_PACKAGE_HEAP: 1g
|
|
INFINITO_CACHE_PACKAGE_DIRECT_MEM: 1g
|
|
INFINITO_CACHE_PACKAGE_HOST_PATH: /mnt/cache/package/data
|
|
|
|
steps:
|
|
- name: 🧹 Free disk space
|
|
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
|
|
with:
|
|
tool-cache: true
|
|
android: true
|
|
dotnet: true
|
|
haskell: true
|
|
large-packages: true
|
|
docker-images: true
|
|
swap-storage: false
|
|
|
|
- name: ⬇️ Checkout repository
|
|
uses: actions/checkout@v7.0.0
|
|
|
|
- name: "📥 Load the rescue paths into job env"
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
{
|
|
grep '^INFINITO_RESCUE_DIAGNOSTICS_BASE=' default.env
|
|
echo "INFINITO_WORKSPACE_SLUG=$(printf '%s' "${DEV_RUNTIME_IMAGE}" | tr '/:' '--')"
|
|
} >> "$GITHUB_ENV"
|
|
|
|
- name: "📥 Resolve the workspace distro"
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
distro="$(python3 -m cli.meta.ci.dev_runtime distro --image "${DEV_RUNTIME_IMAGE}")"
|
|
echo "INFINITO_DISTRO=${distro}" >> "$GITHUB_ENV"
|
|
|
|
- name: ▶️ Run workspace routine
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
HOST_WORKDIR="$(pwd -P)"
|
|
|
|
docker run --rm \
|
|
-e GITHUB_ACTIONS=true \
|
|
-e GITHUB_REPOSITORY="${{ github.repository }}" \
|
|
-e GITHUB_REPOSITORY_OWNER="${{ github.repository_owner }}" \
|
|
-e GITHUB_SHA="${{ github.sha }}" \
|
|
-e DEV_RUNTIME_IMAGE \
|
|
-e INFINITO_DISTRO \
|
|
-e INFINITO_IMAGE="infinito-${INFINITO_DISTRO}" \
|
|
-e INFINITO_PULL_POLICY=never \
|
|
-e INFINITO_BUILD=1 \
|
|
-e NIX_CONFIG \
|
|
-e INFINITO_CACHE_REGISTRY_MAX_SIZE \
|
|
-e INFINITO_CACHE_REGISTRY_HOST_PATH \
|
|
-e INFINITO_CACHE_REGISTRY_CA_HOST_PATH \
|
|
-e INFINITO_CACHE_PACKAGE_BLOBSTORE_MAX \
|
|
-e INFINITO_CACHE_PACKAGE_HEAP \
|
|
-e INFINITO_CACHE_PACKAGE_DIRECT_MEM \
|
|
-e INFINITO_CACHE_PACKAGE_HOST_PATH \
|
|
--network host \
|
|
-v "${HOST_WORKDIR}:${HOST_WORKDIR}" \
|
|
-v "/mnt/docker:/var/lib/docker" \
|
|
-v "/var/run/docker.sock:/var/run/docker.sock" \
|
|
-w "${HOST_WORKDIR}" \
|
|
"${DEV_RUNTIME_IMAGE}" \
|
|
bash -lc '
|
|
bash ./scripts/tests/environment/00_orchestrator.sh
|
|
'
|
|
|
|
- name: 🩺 Capture rescue diagnostics
|
|
if: failure()
|
|
timeout-minutes: 15
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
rescue_dir="${INFINITO_RESCUE_DIAGNOSTICS_BASE:?}/${INFINITO_WORKSPACE_SLUG:?}"
|
|
INFINITO_RESCUE_DIAGNOSTICS_DIR="${rescue_dir}" \
|
|
python3 utils/diagnostics/container.py \
|
|
"${INFINITO_WORKSPACE_SLUG}" "workspace suite failure" || true
|
|
bash ./scripts/tests/deploy/utils/rescue_index.sh "${rescue_dir}"
|
|
|
|
- name: ⬆️ Upload rescue diagnostics
|
|
if: always()
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: rescue-diagnostics-workspace-${{ env.INFINITO_WORKSPACE_SLUG }}
|
|
path: ${{ env.INFINITO_RESCUE_DIAGNOSTICS_BASE }}/
|
|
if-no-files-found: ignore
|