Skip to content

build(docker): Report the commit SHA as the Sentry release - #175

Merged
armenzg merged 1 commit into
mainfrom
build/sentry-release-from-commit-sha
Nov 16, 2026
Merged

armenzg merged 1 commit into
mainfrom
build/sentry-release-from-commit-sha

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Right now the app never sets a Sentry release, so sentry-sdk falls back to K_REVISION, and events report the Cloud Run revision (for example github-actions-app-00050-6tq). The revision name says nothing about which commit is running, so the only way to tell whether main is deployed is to compare timestamps.

With this change, Cloud Build passes COMMIT_SHA into the image as SENTRY_RELEASE. The running app then reports the exact commit SHA it was built from, no matter how the image gets deployed (console or otherwise). That SHA matches the release ci.yml already creates, so the release's commits and suspect commits line up with what's actually live. Builds without the build arg, like the CI Docker build job and local builds, get an empty SENTRY_RELEASE, and the SDK falls back to K_REVISION as before.

This also drops environment: production from the CI release step. Before, it recorded a production deploy at merge time, even though merging doesn't deploy. Until there's a real deploy step, Sentry's first-seen time for the release is the deploy signal.

To verify after merge: the Cloud Build trigger has to use cloudbuild.yaml for the build arg to take effect. After the next deploy, events in sentry-github-actions-app should carry a release equal to the deployed commit's full SHA.

via @armenzg.

--

View Session [Sentry]

Cloud Build passes COMMIT_SHA into the image as SENTRY_RELEASE, so the
app's events carry the deployed commit instead of the Cloud Run revision
name. Stop recording a production deploy in CI at merge time, since
merging doesn't deploy.

Co-Authored-By: Armen Zambrano Gasparnian <44410+armenzg@users.noreply.github.com>
@armenzg
armenzg marked this pull request as ready for review November 16, 2026 16:01
@armenzg
armenzg requested a review from a team as a code owner November 16, 2026 16:01
@sentry-junior
sentry-junior Bot requested a review from armenzg November 16, 2026 16:02
@armenzg
armenzg merged commit 80bb196 into main Nov 16, 2026
17 checks passed
@armenzg
armenzg deleted the build/sentry-release-from-commit-sha branch November 16, 2026 16:02
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