Knowing What Is Live
"Is my change live?" should have a yes-or-no answer. Stamp every deploy with its commit, expose it, and let machines compare.
The question that wastes the most time
After a merge, the most common question is "is it live yet?" Without a clear answer, people refresh pages, clear caches and guess. And sometimes the honest answer is "no, the build failed an hour ago", which nobody knew.
The fix is simple: make the running service say which commit it is running.
Step 1: stamp the commit at deploy time
The deploy step adds one environment variable:
--update-env-vars=RELEASE_SHA=$SHORT_SHA
Cloud Build fills in $SHORT_SHA with the short commit ID. Every revision now carries the commit it was built from.
Step 2: expose it
The server has a tiny public endpoint that returns only that value:
router.get('/.../release', (req, res) => {
res.json({ sha: process.env.RELEASE_SHA || null });
});
It reveals nothing sensitive (the commit ID of a deploy) and it is uncached, so the answer is always current. Opening it in a browser shows something like { "sha": "b5a0d60" }, which you compare with the merge commit on GitHub.
Step 3: let a machine compare
People forget to check. Machines do not. This site's speed-check workflow, which runs after every push to main, begins by waiting for the new commit to go live:
want="${GITHUB_SHA:0:7}"
for i in $(seq 1 40); do
got=$(curl -fsS "$SITE/.../release" | node -pe "(JSON.parse(require('fs').readFileSync(0,'utf8')).sha||'').slice(0,7)" || true)
echo "live: $got want: $want"
[ "$got" = "$want" ] && exit 0
sleep 30
done
echo "Deploy not live after 20 minutes"
It asks every 30 seconds, for up to 20 minutes. When the live commit matches the merged one, it measures the new version. The same comparison, made to fail instead of just printing a message, is the cheapest deploy alert there is (see Alerts That Reach You).
Step 4: mark deploys on your charts
Because each speed measurement records the commit it measured, the speed chart in Ravi OS draws a dashed line at every deploy. "Did this change make the site slower?" becomes a question you answer by looking, not by guessing.
Other places the version shows
- Cloud Run revisions list the image tag, which is the commit ID.
- Artifact Registry lists one image per commit.
- Logs carry the revision name, so an error can be traced to the exact deploy that produced it.
What not to expose
A version endpoint should return the commit and nothing more. No environment names, no dependency versions, no settings. Each extra detail helps an attacker more than it helps you.
Try it yourself
Add a version endpoint to a service you run, stamped at deploy time. Then, after your next merge, time how long it takes for the endpoint to change. That number is your real time from merge to production.