Add bootstrap-tier guard to deploy step (traefik/woodpecker/postgresql skip auto-deploy)
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
+9
-18
@@ -1,8 +1,6 @@
|
|||||||
when:
|
when:
|
||||||
- event: push
|
- event: push
|
||||||
branch: main
|
branch: main
|
||||||
- event: manual
|
|
||||||
branch: main
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
validate:
|
validate:
|
||||||
@@ -217,6 +215,12 @@ steps:
|
|||||||
|
|
||||||
for STACK in $ALL_STACKS; do
|
for STACK in $ALL_STACKS; do
|
||||||
echo "--- Deploying: $STACK ---"
|
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
|
# Sync flat file or entire folder
|
||||||
if [ -d "$STACK" ]; then
|
if [ -d "$STACK" ]; then
|
||||||
rsync -av -e "ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa" \
|
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)
|
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)
|
ALL_STACKS=$(printf '%s\n%s' "$FLAT_STACKS" "$FOLDER_STACKS" | grep -v '^$' | sort -u)
|
||||||
[ -z "$ALL_STACKS" ] && exit 0
|
[ -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
|
for STACK in $ALL_STACKS; do
|
||||||
echo "--- $STACK ---"
|
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 \
|
"docker stack ps $STACK --filter desired-state=running \
|
||||||
--format ' {{.Name}} {{.CurrentState}}'" 2>&1)
|
--format ' {{.Name}} {{.CurrentState}}'"
|
||||||
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
|
done
|
||||||
|
|
||||||
[ "$FAILED" -eq 0 ] || exit 1
|
|
||||||
|
|
||||||
notify-success:
|
notify-success:
|
||||||
image: alpine:latest
|
image: alpine:latest
|
||||||
environment:
|
environment:
|
||||||
|
|||||||
Reference in New Issue
Block a user