Skip to main content

Version endpoint for deploy verify

Serve the commit your service is running at /.well-known/schemabounce/version so SchemaBounce can confirm a deploy. Examples for Node, Go, Python, Rails, Cloudflare Pages, Netlify, Helm and containers.

SchemaBounce confirms a deploy by asking the running app which commit it runs. The app answers one request: GET /.well-known/schemabounce/version.

The contract: return HTTP 200 and JSON with a commit field holding the commit SHA the build came from. Add Cache-Control: no-store.

{ "commit": "0123456789abcdef0123456789abcdef01234567", "builtAt": "2026-11-18T21:04:00Z" }
  • The platform reads only commit. builtAt is optional and for people.
  • The value must be 7 to 64 hex characters. The platform lowercases it. Anything else, such as unknown, fails the read.
  • The response body is read up to 256 KB. The request times out after 10 seconds. Any status outside 2xx fails the read.
  • Redirects are followed up to 3 times, only to the service's own hosts, and never from HTTPS down to HTTP.

Set the commit at build time from your CI's own variable (GITHUB_SHA, CI_COMMIT_SHA, CIRCLE_SHA1, BUILDKITE_COMMIT), not at runtime.

Why no-store​

A cache in front of the endpoint keeps answering with the previous commit. The platform then never sees the landed commit, and the session holds with "Deploy not seen in time". Exclude the path from your CDN, or send Cache-Control: no-store and make sure the CDN honors it.

One example per stack​

Node (Express)​

// server.js
app.get('/.well-known/schemabounce/version', (_req, res) => {
res.set('Cache-Control', 'no-store');
res.json({ commit: process.env.COMMIT, builtAt: process.env.BUILT_AT });
});
ARG COMMIT
ARG BUILT_AT
ENV COMMIT=$COMMIT BUILT_AT=$BUILT_AT

Go (net/http)​

var commit = "unknown" // set at build time

http.HandleFunc("/.well-known/schemabounce/version", func(w http.ResponseWriter, _ *http.Request) {
w.Header().Set("Content-Type", "application/json")
w.Header().Set("Cache-Control", "no-store")
json.NewEncoder(w).Encode(map[string]string{"commit": commit})
})
go build -ldflags "-X main.commit=$(git rev-parse HEAD)" ./cmd/server

Python (FastAPI)​

import os
from fastapi import FastAPI
from fastapi.responses import JSONResponse

app = FastAPI()

@app.get("/.well-known/schemabounce/version")
def version():
return JSONResponse(
{"commit": os.environ.get("COMMIT", "unknown")},
headers={"Cache-Control": "no-store"},
)

Flask is the same shape: return jsonify(commit=os.environ["COMMIT"]) and set the header on the response.

Rails​

# config/routes.rb
get "/.well-known/schemabounce/version", to: proc {
commit = ENV["GIT_COMMIT"] || File.read(Rails.root.join("REVISION")).strip
[200, { "Content-Type" => "application/json", "Cache-Control" => "no-store" },
[{ commit: commit }.to_json]]
}

GIT_COMMIT is an environment variable your build sets. REVISION is the file Capistrano writes on deploy.

Static site​

A static host has no code to run, so write the answer into a file at build time. Put it where your build copies files to the web root, such as public/.well-known/schemabounce/version:

mkdir -p public/.well-known/schemabounce
printf '{"commit":"%s"}' "$GITHUB_SHA" > public/.well-known/schemabounce/version

Make sure the host serves that file with no caching, or point the service's version check at a path your host does serve (see below).

Cloudflare Pages​

Pages sets CF_PAGES_COMMIT_SHA during the build. Write it into the output folder and add a _headers file there so the answer is never cached:

# build command
mkdir -p dist/.well-known/schemabounce
printf '{"commit":"%s"}' "$CF_PAGES_COMMIT_SHA" > dist/.well-known/schemabounce/version
# dist/_headers
/.well-known/schemabounce/version
Content-Type: application/json
Cache-Control: no-store

Netlify​

Netlify sets COMMIT_REF during the build. Write it the same way, and set the headers in netlify.toml:

mkdir -p dist/.well-known/schemabounce
printf '{"commit":"%s"}' "$COMMIT_REF" > dist/.well-known/schemabounce/version
[[headers]]
for = "/.well-known/schemabounce/version"
[headers.values]
Content-Type = "application/json"
Cache-Control = "no-store"

Both hosts build a preview for every branch. Verify reads the Environment's own address, so point the service at the production or stage URL, not a preview URL.

Helm chart passing the commit as an env var​

Pass the commit at deploy time and let the app read it, as in the Node, Go or Python examples above:

# values.yaml
image:
tag: "" # the commit
commit: ""
# templates/deployment.yaml (container env)
env:
- name: COMMIT
value: {{ .Values.commit | quote }}
helm upgrade --install web ./chart \
--set image.tag="$GITHUB_SHA" \
--set commit="$GITHUB_SHA"

Setting the env var from the same value as the image tag keeps the two in step, so the pods that roll out are the pods that answer. During a rolling update old and new pods answer in turn. That is why a service must report the same commit stableReads times in a row before it counts.

Container image​

Bake the commit into the image from a build argument:

ARG COMMIT
ENV COMMIT=$COMMIT
docker build --build-arg COMMIT="$GITHUB_SHA" -t myapp .

Then the app reads COMMIT as in the Node, Python or Go examples above. A service with no HTTP endpoint at all can use a command on a runner you own: see Private services on a runner.

Header or meta tag instead​

If a JSON route is awkward, set the service's How the running commit is read on its Services tab to one of three:

Read fromSettingExample
A JSON fieldPath and a dot path of object keys, such as commit or build.commit{"build":{"commit":"0123abc"}}
A response headerPath and the header nameX-Commit: 0123abc
An HTML meta tagPath and the tag name<meta name="commit" content="0123abc">

The meta tag must be within the first 256 KB of the page. Exactly one of the three is allowed per service. The path must start with /.

The same setting as a JSON body, for the API (versionCheck.http, with exactly one of json, header or meta):

{ "versionCheck": { "http": { "path": "/api/health", "json": "build.commit" } } }
{ "versionCheck": { "http": { "path": "/api/health", "header": "X-Commit" } } }
{ "versionCheck": { "http": { "path": "/", "meta": "commit" } } }

The JSON dot path walks object keys. It does not index into arrays.

Private services on a runner​

This section sets up a runner on a machine you own, such as a laptop. For a runner in your own Kubernetes cluster, including a home lab or on-premises stage reached over Tailscale or a VPN, see Verify in your own Kubernetes cluster.

A service on a private network sets its reach to runner:<label>. A runner you own and labelled <label> reads the version from inside that network. Nothing about this works until the machine's owner turns it on, in the runner's own local config (runner.toml in the user config directory, or the file SB_RUNNER_CONFIG names):

[deploy_verify]
enabled = true
# Optional. When present, checks reach only these hosts; an empty list allows none.
allowed_hosts = ["10.0.0.5"]

# For a service with no HTTP endpoint: the label maps to the command that
# prints the running commit on its first line.
[deploy_verify.version_commands]
office-lan = "cat /srv/app/COMMIT"

The command lives only in that file. SchemaBounce never sends a command to a runner, and the Services form has no command field. A runner without enabled = true advertises nothing and claims nothing. A file that is not valid TOML turns all of this off, with a line in the runner's log. A command runs in an empty temporary directory with only PATH and a temporary HOME, and is stopped after 60 seconds along with anything it started. A key "<label>/<service>" overrides <label> for one service.

Checks never reach loopback, link-local (169.254.0.0/16, fe80::/10) or cloud metadata addresses unless allowed_hosts names that exact host.

What enabled = true also allows​

The same switch lets this runner run the repository's verify: steps on the machine, for sessions you started. Those steps run as your user, with your files and your network. The runner gives each step only the secrets that step names, and it cannot keep a repository's own commands away from your home directory, your cloud credentials or anything else your account can reach. It does not limit the network either. The runner's source states what it can and cannot protect under "ISOLATION ON A LAPTOP, STATED AS IT IS" at the top of code-sandbox-runner/cmd/runner/laptop_verify.go. Turn it on only for a machine and a repository you would run yourself.

Check it​

On the Environment's Services tab, choose Check now in the service's menu. It shows the commit the platform read, how it read it (json, header or meta), or the reason the read failed.

Continue exploring