Skip to content

build(deploy): Deploy to Cloud Run on every merge to main - #181

Merged
armenzg merged 2 commits into
mainfrom
feat/cloudbuild-deploy-on-main
Nov 19, 2026
Merged

armenzg merged 2 commits into
mainfrom
feat/cloudbuild-deploy-on-main

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Right now the Cloud Build trigger on main only builds and pushes the image, and someone has to deploy it by hand from the Cloud Run console. This adds the deploy to cloudbuild.yaml, so every merge to main rolls out a new revision.

Changes to cloudbuild.yaml:

  • An explicit docker push --all-tags step. Cloud Build pushes the images: list only after every step finishes, so without this step the deploy would run before the image exists in the registry. images: stays so the build still records the pushed images.
  • A gcloud run deploy step that deploys :${COMMIT_SHA}. It deploys by tag rather than digest because of the attestation manifest problem described at the top of the file, and by SHA rather than latest so each revision points at a fixed commit. Because it passes only --image, the service keeps its env vars, secrets and runtime service account (github-actions-app@sentry-dev-tooling.iam.gserviceaccount.com).
  • New _SERVICE (github-actions-app) and _REGION (us-central1) substitutions. Both match the service's details page in the Cloud Run console. The trigger can override either one.
  • options.logging: CLOUD_LOGGING_ONLY. Cloud Build rejects a build that runs as a user-managed service account unless the config sets a logs bucket or this option. It also works with the legacy Cloud Build service account.

docs/deployment.md now describes the automatic deploy, how to roll back, and the IAM roles the trigger needs.

IAM: the trigger runs as the legacy Cloud Build service account, 709462749167@cloudbuild.gserviceaccount.com. In getsentry/ops (terraform/sentry-dev-tooling/iam/iam.tf), that account already has roles/cloudbuild.builds.builder, roles/run.admin and a project-level roles/iam.serviceAccountUser. That covers pushing the image and deploying as the runtime account, so this PR needs no IAM changes. Moving the trigger to a dedicated, narrower service account would be a separate change in getsentry/ops.

via @armenzg.

--

View Session [Sentry]

Co-Authored-By: Armen Zambrano Gasparnian <44410+armenzg@users.noreply.github.com>
Co-Authored-By: Armen Zambrano Gasparnian <44410+armenzg@users.noreply.github.com>
@armenzg
armenzg marked this pull request as ready for review November 19, 2026 14:23
@armenzg
armenzg requested a review from a team as a code owner November 19, 2026 14:23
@sentry-junior
sentry-junior Bot requested a review from armenzg November 19, 2026 14:23
@armenzg
armenzg merged commit d39a747 into main Nov 19, 2026
17 checks passed
@armenzg
armenzg deleted the feat/cloudbuild-deploy-on-main branch November 19, 2026 14:23
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