From 98dafc3f4e36205a2b77ccc8e1270f81857bf263 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Thu, 4 Jun 2026 17:06:43 +0200 Subject: [PATCH] feat(ci): zip and upload generated inventory as a debug artifact Both deploy workflows now ship the rendered inventory for the matrix entry as a zip artifact so failed runs can be inspected without re-running the provisioner. test-deploy-swarm.yml zips /tmp/inv directly; test-deploy-server.yml docker-cps /root/inventories from every running infinito_nexus_* container into a staging dir first because the inventory lives inside the compose container, not on the runner. Both steps are if: always() to capture artifacts on failure too, but gated on \!env.ACT because act-local does not provide ACTIONS_RUNTIME_TOKEN and would otherwise fail the upload step. Co-Authored-By: Claude Opus 4.7 --- .github/workflows/test-deploy-server.yml | 15 ++++++++++++++ .github/workflows/test-deploy-swarm.yml | 15 ++++++++++++++ .../inventory/zip_compose_for_upload.sh | 20 +++++++++++++++++++ .../github/inventory/zip_swarm_for_upload.sh | 11 ++++++++++ 4 files changed, 61 insertions(+) create mode 100755 scripts/github/inventory/zip_compose_for_upload.sh create mode 100755 scripts/github/inventory/zip_swarm_for_upload.sh diff --git a/.github/workflows/test-deploy-server.yml b/.github/workflows/test-deploy-server.yml index add2bac3c7..9619dbd227 100644 --- a/.github/workflows/test-deploy-server.yml +++ b/.github/workflows/test-deploy-server.yml @@ -152,3 +152,18 @@ jobs: name: playwright-server-${{ matrix.apps }} path: /tmp/playwright-artifacts/ if-no-files-found: ignore + + - name: Zip generated inventory for debugging + if: always() + shell: bash + env: + APP_ID: ${{ matrix.apps }} + run: bash scripts/github/inventory/zip_compose_for_upload.sh + + - name: Upload inventory artifact + if: ${{ always() && !env.ACT }} + uses: actions/upload-artifact@v7 + with: + name: inventory-server-${{ matrix.apps }} + path: /tmp/inventory-server-${{ matrix.apps }}.zip + if-no-files-found: ignore diff --git a/.github/workflows/test-deploy-swarm.yml b/.github/workflows/test-deploy-swarm.yml index 0ea956396c..4658c01dd2 100644 --- a/.github/workflows/test-deploy-swarm.yml +++ b/.github/workflows/test-deploy-swarm.yml @@ -156,6 +156,21 @@ jobs: if: failure() run: ${{ env.SCRIPTS }}/16_collect_diagnostics.sh + - name: "Zip generated inventory for debugging" + if: always() + shell: bash + env: + APP_ID: ${{ matrix.apps }} + run: bash scripts/github/inventory/zip_swarm_for_upload.sh + + - name: "Upload inventory artifact" + if: ${{ always() && !env.ACT }} + uses: actions/upload-artifact@v7 + with: + name: inventory-swarm-${{ matrix.apps }} + path: /tmp/inventory-swarm-${{ matrix.apps }}.zip + if-no-files-found: ignore + - name: "Cleanup" if: always() run: ${{ env.SCRIPTS }}/17_cleanup.sh diff --git a/scripts/github/inventory/zip_compose_for_upload.sh b/scripts/github/inventory/zip_compose_for_upload.sh new file mode 100755 index 0000000000..f6d5a54153 --- /dev/null +++ b/scripts/github/inventory/zip_compose_for_upload.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +set -euo pipefail + +: "${APP_ID:?APP_ID is required (matrix.apps)}" + +out="/tmp/inventory-server-${APP_ID}.zip" +stage="/tmp/inventory-server-${APP_ID}" +rm -rf "${stage}" +mkdir -p "${stage}" + +mapfile -t containers < <(docker ps --format '{{.Names}}' | grep '^infinito_nexus_' || true) +for c in "${containers[@]}"; do + docker cp "${c}:/root/inventories" "${stage}/${c}-inventories" 2>/dev/null || true +done + +if [[ -d "${stage}" && -n "$(ls -A "${stage}" 2>/dev/null)" ]]; then + (cd /tmp && zip -r "${out}" "inventory-server-${APP_ID}") +else + echo "No inventories captured from compose containers" +fi diff --git a/scripts/github/inventory/zip_swarm_for_upload.sh b/scripts/github/inventory/zip_swarm_for_upload.sh new file mode 100755 index 0000000000..4026cf0c08 --- /dev/null +++ b/scripts/github/inventory/zip_swarm_for_upload.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +set -euo pipefail + +: "${APP_ID:?APP_ID is required (matrix.apps)}" + +out="/tmp/inventory-swarm-${APP_ID}.zip" +if [[ -d /tmp/inv ]]; then + (cd /tmp && zip -r "${out}" inv) +else + echo "No inventory found at /tmp/inv" +fi