Files
computer-playbook/scripts/github/inventory/zip_swarm_for_upload.sh
T
kevinveenbirkenbachandClaude Opus 4.8 6bbe3f61e3 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>
2026-06-30 00:59:49 +02:00

33 lines
1.0 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
: "${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
mkdir -p "${stage}"
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 [[ "${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-swarm-${APP_ID}")