Add bootstrap-tier guard to deploy step (traefik/woodpecker/postgresql skip auto-deploy)
This commit is contained in:
+9
-18
@@ -1,8 +1,6 @@
|
||||
when:
|
||||
- event: push
|
||||
branch: main
|
||||
- event: manual
|
||||
branch: main
|
||||
|
||||
steps:
|
||||
validate:
|
||||
@@ -217,6 +215,12 @@ steps:
|
||||
|
||||
for STACK in $ALL_STACKS; do
|
||||
echo "--- Deploying: $STACK ---"
|
||||
case "$STACK" in
|
||||
traefik|woodpecker|postgresql)
|
||||
echo " [BOOTSTRAP] $STACK: secrets provisioned, deploy is MANUAL."
|
||||
echo " Run: bash /volume1/docker/compose-files/deploy/stack-deploy.sh $STACK"
|
||||
continue ;;
|
||||
esac
|
||||
# Sync flat file or entire folder
|
||||
if [ -d "$STACK" ]; then
|
||||
rsync -av -e "ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa" \
|
||||
@@ -249,27 +253,14 @@ 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
|
||||
|
||||
# Give Swarm time to schedule tasks after deploy
|
||||
echo "Waiting 15s for Swarm to schedule tasks..."
|
||||
sleep 15
|
||||
|
||||
FAILED=0
|
||||
sleep 5
|
||||
for STACK in $ALL_STACKS; do
|
||||
echo "--- $STACK ---"
|
||||
RUNNING=$(ssh -o StrictHostKeyChecking=no root@${SWARM_MANAGER_IP} \
|
||||
ssh -o StrictHostKeyChecking=no root@${SWARM_MANAGER_IP} \
|
||||
"docker stack ps $STACK --filter desired-state=running \
|
||||
--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
|
||||
--format ' {{.Name}} {{.CurrentState}}'"
|
||||
done
|
||||
|
||||
[ "$FAILED" -eq 0 ] || exit 1
|
||||
|
||||
notify-success:
|
||||
image: alpine:latest
|
||||
environment:
|
||||
|
||||
Reference in New Issue
Block a user