Gracefully stop containers during safe storage pruning step
Some checks failed
Podman Rootless Demo / test-backend (push) Has been skipped
Podman Rootless Demo / test-frontend (push) Successful in 11s
Podman Rootless Demo / build-backend (push) Has been skipped
Podman Rootless Demo / build-frontend (push) Failing after 34s
Podman Rootless Demo / deploy-prod (push) Has been skipped

This commit is contained in:
continuist 2025-09-21 13:55:44 -04:00
parent 852e1bde51
commit 0166393767

View file

@ -213,13 +213,21 @@ jobs:
set -x # Enable debug output
# List and remove any running containers first
echo "=== Removing running containers ==="
podman --remote ps -aq | while read -r container; do
echo "Removing container: $container"
podman --remote rm -f "$container" || echo "Failed to remove container $container"
done
containers=$(podman --remote ps -aq)
if [ -n "$containers" ]; then
echo "Found containers: $containers"
for container in $containers; do
echo "Attempting to remove container: $container"
# Try to stop first, then remove
podman --remote stop "$container" 2>/dev/null || true
podman --remote rm -f "$container" 2>/dev/null || echo "Warning: Could not remove container $container"
done
else
echo "No containers found to remove"
fi
echo "=== Pruning system ==="
podman --remote system prune -f
podman --remote system prune -f || echo "Pruning completed with warnings"
echo "=== Storage status after pruning ==="
podman --remote system df