Skip to content

Commit 593e471

Browse files
rajbosCopilot
andcommitted
ci: add post-deploy health check with retry
Polls /health up to 12 times (10s apart, 2 min total) after terraform apply. Fails the workflow if the container never comes up healthy. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent ff788b2 commit 593e471

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

.github/workflows/sharing-server-deploy.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,24 @@ jobs:
236236
TF_VAR_custom_domain: ${{ vars.SHARING_CUSTOM_DOMAIN }}
237237
run: terraform apply -auto-approve tfplan
238238

239+
- name: Health check
240+
if: steps.prereqs.outputs.configured == 'true'
241+
working-directory: sharing-server/infra
242+
run: |
243+
HEALTH_URL=$(terraform output -raw health_url)
244+
echo "Waiting for ${HEALTH_URL} to respond..."
245+
for i in $(seq 1 12); do
246+
STATUS=$(curl -s -o /dev/null -w "%{http_code}" --max-time 10 "${HEALTH_URL}" || echo "000")
247+
if [[ "$STATUS" == "200" ]]; then
248+
echo "✅ Health check passed (attempt ${i})"
249+
exit 0
250+
fi
251+
echo " attempt ${i}/12 — HTTP ${STATUS}, retrying in 10s..."
252+
sleep 10
253+
done
254+
echo "❌ Health check failed after 2 minutes"
255+
exit 1
256+
239257
- name: Output deployment summary
240258
if: steps.prereqs.outputs.configured == 'true'
241259
working-directory: sharing-server/infra

0 commit comments

Comments
 (0)