fix(ci): collect inventory from host inventory dir, not container/tmp

The compose and swarm inventory collectors hard-failed at the 'Zip generated
inventory' step because they looked in the wrong place. Inventory is written on
the runner host at $INFINITO_INVENTORY_DIR (resolve.sh yields
$HOME/inventories/github in CI), but:

- zip_compose_for_upload.sh ran 'docker cp' from infinito_nexus_* containers,
  which dedicated.sh's cleanup trap removes before the always() step runs, so it
  never found a container.
- zip_swarm_for_upload.sh globbed /tmp/inv*, which the matrix orchestrator never
  populates; it defaults its base to $INFINITO_INVENTORY_DIR.

Both now source scripts/meta/env/load.sh to resolve INFINITO_INVENTORY_DIR and
zip that dir plus its per-round '-<n>' variants.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
kevinveenbirkenbachandClaude Opus 4.8 committed 2026-06-30 00:59:49 +02:00
1 parent a4f7430235
commit 6bbe3f61e3
2 files changed
+30 -26

No files matched your search

@@ -1,25 +1,32 @@
#!/usr/bin/env bash
set -euo pipefail
# Collect each running infinito_nexus_* container's /root/inventories into one
# zip for the debug artifact. Hard fail when nothing is captured: a missing
# inventory hides a real deploy/path bug rather than being ignored at upload.
: "${APP_ID:?APP_ID is required (matrix.apps)}"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "${SCRIPT_DIR}/../../.." && pwd)"
cd "${REPO_ROOT}"
# shellcheck source=scripts/meta/env/load.sh
source scripts/meta/env/load.sh
: "${INFINITO_INVENTORY_DIR:?INFINITO_INVENTORY_DIR must be resolved by scripts/meta/env/load.sh}"
out="/tmp/inventory-compose-${APP_ID}.zip"
stage="/tmp/inventory-compose-${APP_ID}"
rm -rf "${stage}"
sudo rm -rf "${stage}" 2>/dev/null || rm -rf "${stage}" 2>/dev/null || true
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
shopt -s nullglob
found=0
for d in "${INFINITO_INVENTORY_DIR}" "${INFINITO_INVENTORY_DIR}"-*; do
[[ -d "${d}" ]] || continue
sudo cp -a "${d}" "${stage}/$(basename "${d}")" 2>/dev/null || cp -a "${d}" "${stage}/$(basename "${d}")"
found=1
done
if [[ -d "${stage}" && -n "$(ls -A "${stage}" 2>/dev/null)" ]]; then
(cd /tmp && zip -r "${out}" "inventory-compose-${APP_ID}")
else
echo "::error::No inventories captured from compose containers (no /root/inventories in any infinito_nexus_* container)." >&2
if [[ "${found}" -eq 0 ]]; then
echo "::error::No inventory found under ${INFINITO_INVENTORY_DIR}* on the runner." >&2
exit 1
fi
sudo chown -R "$(id -u):$(id -g)" "${stage}" 2>/dev/null || true
(cd /tmp && zip -r "${out}" "inventory-compose-${APP_ID}")
@@ -1,18 +1,15 @@
#!/usr/bin/env bash
set -euo pipefail
# Collect the swarm test inventories for the debug artifact. The matrix
# orchestrator (cli.administration.deploy.swarm.matrix) runs as root and writes
# a per-round inventory to /tmp/inv-<n> (plus the /tmp/inv base), so this must
# gather every /tmp/inv* dir -- not the single /tmp/inv the old version checked,
# which the planner never populates -- and de-root them so the unprivileged
# upload step can read the zip.
#
# Hard fail when there is nothing to copy: a silently-missing inventory hides a
# real provisioning/path bug rather than being ignored at upload time.
: "${APP_ID:?APP_ID is required (matrix.apps)}"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "${SCRIPT_DIR}/../../.." && pwd)"
cd "${REPO_ROOT}"
# shellcheck source=scripts/meta/env/load.sh
source scripts/meta/env/load.sh
: "${INFINITO_INVENTORY_DIR:?INFINITO_INVENTORY_DIR must be resolved by scripts/meta/env/load.sh}"
out="/tmp/inventory-swarm-${APP_ID}.zip"
stage="/tmp/inventory-swarm-${APP_ID}"
sudo rm -rf "${stage}" 2>/dev/null || rm -rf "${stage}" 2>/dev/null || true
@@ -20,16 +17,16 @@ mkdir -p "${stage}"
shopt -s nullglob
found=0
for d in /tmp/inv /tmp/inv-*; do
for d in "${INFINITO_INVENTORY_DIR}" "${INFINITO_INVENTORY_DIR}"-*; do
[[ -d "${d}" ]] || continue
sudo cp -a "${d}" "${stage}/$(basename "${d}")"
sudo cp -a "${d}" "${stage}/$(basename "${d}")" 2>/dev/null || cp -a "${d}" "${stage}/$(basename "${d}")"
found=1
done
if [[ "${found}" -eq 0 ]]; then
echo "::error::No swarm inventory found to copy (expected /tmp/inv or /tmp/inv-*)." >&2
echo "::error::No inventory found under ${INFINITO_INVENTORY_DIR}* on the runner." >&2
exit 1
fi
sudo chown -R "$(id -u):$(id -g)" "${stage}"
sudo chown -R "$(id -u):$(id -g)" "${stage}" 2>/dev/null || true
(cd /tmp && zip -r "${out}" "inventory-swarm-${APP_ID}")