Agent Wranglers

Build, test and deploy Required

Stamp every build with its version

Give every build a version and the commit it came from. Show both in the running app, and tag each release in version control.

How to do it

Pass the version and commit hash into the build, for example as build arguments or a generated file. Never type them by hand. Return them from a version address or the health check, and add them to every log line and error report. Tag the commit of every production release, such as v2026.10.20-1 or a semantic version for a library. Send the version to the dashboards as a deploy marker.

Example

docker build --build-arg VERSION="$(git describe --tags --always)" --build-arg COMMIT="$(git rev-parse HEAD)" .
// The Dockerfile turns the build arguments into environment variables
app.get('/version', (req, res) => {
  res.json({ version: process.env.VERSION, commit: process.env.COMMIT });
});
# Flask
@app.get("/version")
def version():
    return {"version": os.environ["VERSION"], "commit": os.environ["COMMIT"]}
// Set at build time: go build -ldflags "-X main.commit=$(git rev-parse HEAD)"
var commit = "unknown"

http.HandleFunc("/version", func(w http.ResponseWriter, r *http.Request) {
	json.NewEncoder(w).Encode(map[string]string{"commit": commit})
})

How to check

After a deploy, the version address returns the commit hash of the deployed commit. git tag --points-at <that commit> prints the release tag.

For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers engineering playbook: https://agentwranglers.se/playbook/engineering/build-test-and-deploy/version-every-release.