Skip to content

api | docs: pass the git commit to builds and running services - #41

Merged
bbedward merged 1 commit into
masterfrom
unb-416-pass-the-git-commit-to-builds-and-runnin
Oct 19, 2026
Merged

bbedward merged 1 commit into
masterfrom
unb-416-pass-the-git-commit-to-builds-and-runnin

Conversation

@bbedward

Copy link
Copy Markdown
Contributor

Builds and pods never got the commit they came from, so apps that stamp their version from CI report development.

UNBIND_GIT_SHA and UNBIND_GIT_BRANCH now reach:

  • Dockerfile builds as build args, when the Dockerfile declares them with ARG, through the existing ARG detection.
  • Railpack builds as env on the plan's build step only. Railpack mounts the hash of all secrets into every step (buildkit/build_llb/build_graph.go), so passing a per-commit value as a secret would rerun install on every commit. The build step copies the source and reruns anyway. TestAddBuildStepVariablesKeepsInstallCached checks that install's LLB stays the same across commits.
  • Pods as env on the Service CRD: from the builder after a build, and from the deployment's commit_sha/git_branch on redeploys that skip the build, rollouts after variable changes, and removing the active deployment. Those paths rebuild EnvVars because it is pruned from stored resource definitions.

The SHA is the one the builder actually cloned. The branch comes from the ref; tag builds get no branch. The branch is part of the image config digest, so two branches at one commit don't share an image with the wrong branch baked in. That rotates railpack's cache-mount key and image tags once after upgrade. The registry cache key doesn't change.

Both names are reserved for new variables, the same way endpoint keys are. A value already stored under one of them is overridden by Unbind's.

Docs: new Git commit section in Variables, plus a note in Builds.

fixes UNB-416

UNBIND_GIT_SHA and UNBIND_GIT_BRANCH reach Dockerfile builds as ARGs,
railpack's build step as env, and every pod of a git service as env.
Both names are reserved for new variables.

UNB-416
@bbedward
bbedward merged commit 26c310f into master Oct 19, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant