Deploy backend from manual workflow runs
Verify and deploy API / verify-deploy (push) Failing after 4m25s

This commit is contained in:
2026-09-18 23:16:30 +08:00
parent 566870a358
commit 574e47c219
+16 -3
View File
@@ -54,16 +54,29 @@ jobs:
- name: Run checks in image build
run: docker build --target test --tag "pk-lab-server:$SOURCE_REVISION-test" .
- name: Build runtime image
if: gitea.event_name == 'push' && gitea.ref == 'refs/heads/main'
if: gitea.ref == 'refs/heads/main' && gitea.event_name != 'pull_request'
run: docker build --target runtime --tag "pk-lab-server:$SOURCE_REVISION" .
- name: Update permanent stack without deleting data
if: gitea.event_name == 'push' && gitea.ref == 'refs/heads/main'
if: gitea.ref == 'refs/heads/main' && gitea.event_name != 'pull_request'
run: |
set -eu
test -n "$POSTGRES_PASSWORD"
export DEPLOY_IMAGE="pk-lab-server:$SOURCE_REVISION"
sh scripts/deploy.sh
docker compose -p pk-lab-production exec -T api python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/health', timeout=3)"
for container in pk-lab-xhs-preview rice-pk-xhs-preview; do
if docker inspect "$container" >/dev/null 2>&1; then
ready=false
for i in 1 2 3 4 5 6 7 8 9 10; do
if docker exec "$container" wget -q -O- http://127.0.0.1:8080/api/v1/tests >/dev/null; then
ready=true
break
fi
sleep 2
done
[ "$ready" = true ]
fi
done
- name: Probe public endpoint
if: gitea.event_name == 'push' && gitea.ref == 'refs/heads/main' && env.PUBLIC_BASE_URL != ''
if: gitea.ref == 'refs/heads/main' && gitea.event_name != 'pull_request' && env.PUBLIC_BASE_URL != ''
run: curl --fail --silent --show-error --connect-timeout 10 --max-time 20 "${PUBLIC_BASE_URL%/}/health"