Files
computer-playbook/scripts/github/inventory/zip_compose_for_upload.sh
T
kevinveenbirkenbachandClaude Opus 4.8 ed7ccbaaf2 fix(ci): collect swarm inventories + hard-fail when none to copy
zip_swarm_for_upload.sh only checked the base /tmp/inv, but the matrix
orchestrator writes per-round dirs /tmp/inv-<n> (and runs as root), so the
artifact was always empty. Collect every /tmp/inv* dir with sudo and de-root
the staged copy before zipping.

Both the swarm and compose collectors now hard-fail (exit 1) when they find no
inventory to copy, instead of echoing and exiting 0, so a silently-missing
artifact surfaces a real provisioning/path bug.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-29 21:06:42 +02:00

26 lines
932 B
Bash
Executable File

#!/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)}"
out="/tmp/inventory-compose-${APP_ID}.zip"
stage="/tmp/inventory-compose-${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-compose-${APP_ID}")
else
echo "::error::No inventories captured from compose containers (no /root/inventories in any infinito_nexus_* container)." >&2
exit 1
fi