Articles

How to verify which version is running in production

Verify the exact deployment in CI, then check production traffic separately. Follow a real Gregale release from 0% traffic to a guarded promotion.

Updated

To verify which version is running in production, check two things: the revision that answers the app’s stable URL and how traffic is allocated across revisions. A green CI run tells you the build passed. A deployment-specific URL tells you the candidate can answer. Neither tells you which version your users are reaching.

Get the runnable example on GitHub · Download the example

What to record in CI

RecordWhat it answers
Git commit SHA from the checkout you builtWhich source did CI build?
Deployment UUID returned by the hostWhich specific deployment did the platform accept?
Exact-revision HTTP response and expected markerDid that deployment actually run the code I expected?
Traffic allocation and a request to the stable URLWhich deployments are eligible to serve users, and which one handled this request?

Stamp a known build marker into the artifact, and expose it on a small read-only endpoint such as /version. For example, write git rev-parse HEAD to a marker file from a clean CI checkout before packaging the artifact. Use your normal app access controls and avoid exposing internal metadata unnecessarily. In CI, compare against the commit already checked out, not the current head of a branch that could have advanced. If you deploy from a dirty working tree, the checkout’s Git SHA alone does not identify the artifact.

On Gregale, capture the deploy command’s returned UUID. Avoid using latest as a stand-in for production: the latest deployment can be pending, failed, or staged with no traffic.

1. Stage a release at 0% traffic

Run this example from the downloaded directory, using the Gregale CLI and jq. Pick an unused app name and use a disposable app. The fixture changes only a text marker served by GET /version.

bash
set -euo pipefail
APP='replace-with-a-new-demo-app'
g() { gregale --non-interactive --json "$@"; }

printf 'A\n' > release.txt
A="$(g deploy --name "$APP" --source=worktree | jq -er '.id')"

printf 'B\n' > release.txt
B="$(g deploy --name "$APP" --source=worktree --no-traffic | jq -er '.id')"
test "$A" != "$B"

2. Verify the exact candidate, then check who is serving

bash
check_version() {
  g release verify "$1" --app "$APP" --path /version |
    jq -e --arg id "$1" --arg expected "$2" '
      .verified and .deployment_id == $id and .http_status == 200
      and (.body | fromjson) == {release: $expected}'
}

check_version "$B" B
gregale release traffic status "$APP"

B should answer with {"release":"B"} even though the traffic table shows A at 100% and B at 0%. If you can reach the normal app URL, check its /version route too: it should still return A. For a private app, use its normal request authorization. Do not use the candidate’s preview URL for this check.

release verify sends an owner-authorized request directly to one deployment. It checks that deployment’s response, not anonymous access, a custom domain, or which version handled a normal request.

3. Promote the verified revision and confirm the switch

For this disposable demo, promote B directly. --if-serving "$A" refuses the promotion if A is no longer at 100%; on a conflict, inspect the traffic status before deciding what to do next.

bash
g release traffic promote --app "$APP" --release "$B" --if-serving "$A"
gregale release traffic status "$APP"
check_version "$B" B

Confirm B is at 100%, then request the same stable URL again if you can access it. It should now return B. One stable request only shows which revision handled that request; it does not rule out a traffic split. Keep the traffic check in CI alongside the application check.

For a customer-facing deployment, you can use a gradual rollout rather than jumping straight to 100%. Gate your promotion on a check that exercises meaningful behavior, not just a generic health response. If a single response marker is all you verify, that is the extent of the proof.

Hosted test results

We ran the example on one private Gregale app in a Scale account. The owner-authorized probe returned HTTP 200 and {"release":"B"} from the exact candidate at 0%. The traffic table switched to B at 100% after guarded promotion. Authenticated requests to the same stable URL returned A before promotion and B afterward.

These are the traffic fields from the CLI response (other fields omitted):

text
Staged:   [{"revision":1,"traffic_percent":100},{"revision":2,"traffic_percent":0}]
Promoted: [{"revision":1,"traffic_percent":0},{"revision":2,"traffic_percent":100}]

The test checked a single route. It did not verify anonymous access, custom-domain routing, or a canary rollout.

For a follow-up check before a real rollout, see shadow test a release with traffic mirroring. If you need to validate the artifact itself rather than its response, see verify a container image before rollback.

For a browser regression a 200 alone won’t reveal, see how to test a Vite tab opened before the deploy.

Questions

How do I check which Git commit is deployed to production?

Record the Git commit used by CI with the exact deployment ID. Compare a build marker from the stable application URL to that commit and check the host’s traffic allocation to see whether other revisions also serve traffic.

Can I verify a Gregale deployment before it receives production traffic?

Yes. Stage it with gregale deploy --no-traffic, verify the response on the exact deployment ID, and inspect traffic status separately before promotion.

Does a successful deployment verification mean the revision is serving production traffic?

No. An exact-deployment check can succeed at 0% traffic. Check the production traffic allocation and request the stable app URL to confirm what users reach.