From 2b4332896eb1e740a312669bedb6835d2e62ff15 Mon Sep 17 00:00:00 2001 From: admin Date: Wed, 8 Jul 2026 21:23:00 -0700 Subject: [PATCH] fix(ci): verify step fails pipeline on zero running tasks; increase settle time --- .woodpecker.yml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 02c8266..5739cb4 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -247,14 +247,27 @@ steps: FOLDER_STACKS=$(echo "$CHANGED_FILES" | grep -E '^[^/]+/' | cut -d/ -f1 | sort -u || true) ALL_STACKS=$(printf '%s\n%s' "$FLAT_STACKS" "$FOLDER_STACKS" | grep -v '^$' | sort -u) [ -z "$ALL_STACKS" ] && exit 0 - sleep 5 + + # Give Swarm time to schedule tasks after deploy + echo "Waiting 15s for Swarm to schedule tasks..." + sleep 15 + + FAILED=0 for STACK in $ALL_STACKS; do echo "--- $STACK ---" - ssh -o StrictHostKeyChecking=no root@${SWARM_MANAGER_IP} \ + RUNNING=$(ssh -o StrictHostKeyChecking=no root@${SWARM_MANAGER_IP} \ "docker stack ps $STACK --filter desired-state=running \ - --format ' {{.Name}} {{.CurrentState}}'" + --format ' {{.Name}} {{.CurrentState}}'" 2>&1) + echo "$RUNNING" + COUNT=$(echo "$RUNNING" | grep -c 'Running\|Starting\|Preparing' || true) + if [ "$COUNT" -eq 0 ]; then + echo " ERROR: No running tasks found for stack '$STACK' — deploy may have failed!" + FAILED=1 + fi done + [ "$FAILED" -eq 0 ] || exit 1 + notify-success: image: alpine:latest environment: