fix: harden deploy workflow health and git sync

This commit is contained in:
cesnimda
2026-03-22 23:29:36 +01:00
parent c818ad7776
commit 691f263bc0
2 changed files with 18 additions and 3 deletions
+17 -2
View File
@@ -60,7 +60,14 @@ jobs:
exit 1
fi
cd /opt/job-tracker/app
git fetch --all --prune
if ! git fetch --all --prune; then
echo "git fetch failed on server. Check remote auth/URL for /opt/job-tracker/app."
exit 1
fi
if ! git rev-parse --verify --quiet ${{ github.sha }} >/dev/null; then
echo "Commit ${{ github.sha }} is not available in the server checkout after fetch."
exit 1
fi
git reset --hard ${{ github.sha }}
git clean -fd
chmod +x deploy/deploy.sh
@@ -69,4 +76,12 @@ jobs:
APP_BUILD_STAMP="$(date -u +'%Y-%m-%d %H:%M UTC')" \
./deploy/deploy.sh
docker compose ps
docker compose exec -T summarizer python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8001/health', timeout=5).read()"
docker compose exec -T summarizer python -c "import time, urllib.request; deadline=time.time()+60; last=None
for _ in range(30):
try:
urllib.request.urlopen('http://127.0.0.1:8001/health', timeout=5).read()
raise SystemExit(0)
except Exception as exc:
last=exc
time.sleep(2)
raise last"