From dcd6d056218eaea96e5a9125c3f84adff655e184 Mon Sep 17 00:00:00 2001 From: Joshua Dirga Date: Wed, 20 Nov 2024 17:57:35 -0500 Subject: [PATCH] Changed github workflow file to try migrations 5 times --- .github/workflows/deploy-dev.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-dev.yml b/.github/workflows/deploy-dev.yml index 0e42987..e31dbfa 100644 --- a/.github/workflows/deploy-dev.yml +++ b/.github/workflows/deploy-dev.yml @@ -45,6 +45,17 @@ jobs: sudo systemctl stop nginx sudo systemctl restart nginx docker stack deploy -c docker-compose.yml the-stack --with-registry-auth - sleep 30s - docker exec $(docker ps -q -f name=the-stack_web) flask db upgrade + sleep 60s + attempt=1 + max_attempts=5 + until docker exec $(docker ps -q -f name=the-stack_web) flask db upgrade || [ $attempt -eq $max_attempts ] + do + echo "Migration attempt $attempt failed. Retrying..." + sleep 15 + attempt=$((attempt + 1)) + done + if [ $attempt -eq $max_attempts ]; then + echo "Migration failed after $max_attempts attempts" + exit 1 + fi yes | docker system prune -a