fix(ci): verify step fails pipeline on zero running tasks; increase settle time
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
+16
-3
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user