Files
agiledancers/ci/cleanup.sh
Wanja Krah 74a5aa1237
All checks were successful
Build, test and publish / verify (push) Successful in 1m41s
Add Gitea build, container tests and registry publication
2026-10-28 17:07:23 +01:00

30 lines
1.2 KiB
Bash

#!/usr/bin/env bash
source "$(dirname -- "$0")/common.sh"
status=0
# Copy only test diagnostics, never environment dumps, Docker inspect or credentials.
for report in agiledancers-be/target/surefire-reports agiledancers-be/target/failsafe-reports \
agiledancers-fe/unit-results agiledancers-fe/test-results agiledancers-fe/playwright-report; do
if [[ -d "$report" ]]; then
destination="$ARTIFACTS/$report"
mkdir -p "$destination"
cp -R "$report/." "$destination/" || status=1
fi
done
if docker info >/dev/null 2>&1; then
for role in backend frontend browser; do
container="$RUN_NAME-$role"
if docker container inspect "$container" >/dev/null 2>&1; then
docker logs "$container" > "$ARTIFACTS/$role.log" 2>&1 || status=1
docker rm -f "$container" >/dev/null || status=1
fi
done
if docker network inspect "$RUN_NAME" >/dev/null 2>&1; then
docker network rm "$RUN_NAME" >/dev/null || status=1
fi
rm -f "$ARTIFACTS/containers-started"
elif [[ -f "$ARTIFACTS/containers-started" ]]; then
echo "Docker is unavailable; cleanup could not be confirmed" >&2
status=1
fi
exit "$status"