Check the deployed revision, not just any 200, in the health poll
/api/health now reports REVISION alongside status, and the CI wait step checks for this deploy's own short SHA specifically - a stray old container that never got torn down (or a build that silently kept serving stale code) would still 200 on a plain health check but now won't match.
This commit is contained in:
1 parent
4982f04258
commit
5c9516d038
4 files changed
+20
-13
No files matched your search
+10
-6
@@ -114,17 +114,21 @@ jobs:
|
||||
# (Type=simple, no readiness protocol) — not that `podman compose up
|
||||
# --build` actually finished and Puma is answering. Polls the health
|
||||
# endpoint (cube-host itself, same machine the container's port is
|
||||
# published on) instead of trusting that. 5 minutes covers even a
|
||||
# from-scratch rebuild (Gemfile change, ~3.5 minutes measured) with
|
||||
# room to spare; a cached rebuild is normally up within a minute.
|
||||
# published on) instead of trusting that — checking for this
|
||||
# deploy's own revision, not just any 200, so a stuck old container
|
||||
# that never got torn down can't pass as a successful deploy of the
|
||||
# new one. 5 minutes covers even a from-scratch rebuild (Gemfile
|
||||
# change, ~3.5 minutes measured) with room to spare; a cached
|
||||
# rebuild is normally up within a minute.
|
||||
- name: Wait for it to come up
|
||||
run: |
|
||||
expected=$(git rev-parse --short HEAD)
|
||||
for i in $(seq 1 30); do
|
||||
if curl -sf http://localhost:4567/api/health >/dev/null; then
|
||||
echo "Healthy after $(( (i - 1) * 10 ))s"
|
||||
if curl -sf http://localhost:4567/api/health | grep -q "\"revision\":\"$expected\""; then
|
||||
echo "Healthy at $expected after $(( (i - 1) * 10 ))s"
|
||||
exit 0
|
||||
fi
|
||||
sleep 10
|
||||
done
|
||||
echo "::error::maptool did not become healthy within 5 minutes"
|
||||
echo "::error::maptool did not report revision $expected within 5 minutes"
|
||||
exit 1
|
||||
Reference in new issue
Block a user