From ef2b5b70fcbe8b1f6623fee8477285a50de62c9e Mon Sep 17 00:00:00 2001 From: continuist Date: Sun, 21 Sep 2025 14:03:11 -0400 Subject: [PATCH] stop and remove containers and pods first --- .forgejo/workflows/ci.yml | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml index 82f59af..4fbdb41 100644 --- a/.forgejo/workflows/ci.yml +++ b/.forgejo/workflows/ci.yml @@ -197,6 +197,21 @@ jobs: --password-stdin \ "${{ secrets.REGISTRY_HOST }}" + - name: Force cleanup all containers and pods + run: | + set -x + echo "=== Force stopping all containers ===" + podman --remote ps -aq | xargs -r podman --remote stop --time 5 2>/dev/null || true + + echo "=== Force removing all containers ===" + podman --remote ps -aq | xargs -r podman --remote rm -f 2>/dev/null || true + + echo "=== Force stopping all pods ===" + podman --remote pod ps -q | xargs -r podman --remote pod stop --time 5 2>/dev/null || true + + echo "=== Force removing all pods ===" + podman --remote pod ps -q | xargs -r podman --remote pod rm -f 2>/dev/null || true + - name: Disk preflight diagnostic run: | echo "=== Podman storage info ===" @@ -210,25 +225,9 @@ jobs: - name: Safe storage pruning run: | - set -x # Enable debug output - # List and remove any running containers first - echo "=== Removing running containers ===" - 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 with timeout, then remove - timeout 10s podman --remote stop "$container" 2>/dev/null || echo "Timeout or error stopping container $container" - timeout 5s podman --remote rm -f "$container" 2>/dev/null || echo "Warning: Could not remove container $container" - done - else - echo "No containers found to remove" - fi - + set -x echo "=== Pruning system ===" - podman --remote system prune -f || echo "Pruning completed with warnings" - + podman --remote system prune -f echo "=== Storage status after pruning ===" podman --remote system df