build(vercel): Skip deployment when only backend files change#114029
build(vercel): Skip deployment when only backend files change#114029vgrozdanic merged 10 commits intomasterfrom
Conversation
Add an ignoreCommand that checks whether any frontend-relevant files were modified. Vercel will skip the build when changes are limited to backend code, reducing unnecessary deployments. Co-Authored-By: Claude <noreply@anthropic.com>
The ignoreCommand regex was missing src/sentry/locale/ and src/sentry/static/images/logos/, both of which are whitelisted in .vercelignore as build inputs. Changes to those paths would silently skip deployments, leaving previews with stale translations or logos. Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Pretty sure the comment about "single-commit branch"es isn't relevant, PRs with branches off master will point to the commit they branched off from.
what if we want to force a preview build? is there a way to do so in vercel? or an easy way to do so in a PR?
| @@ -29,5 +29,6 @@ | |||
| ] | |||
| } | |||
| ], | |||
| "github": {"silent": true} | |||
| "github": {"silent": true}, | |||
| "ignoreCommand": "! git diff HEAD^ HEAD --name-only | grep -qE '^(static/|build-utils/|src/sentry/locale/|src/sentry/static/images/logos/|package\\.json|pnpm-lock\\.yaml|tsconfig\\.json|rspack\\.config\\.ts|vercel\\.json|\\.vercelignore|config/)'" | |||
There was a problem hiding this comment.
config/ isn't relevant - can remove.
otherwise lgtm
@kenzoengineer you can add that file in the config temporarily if needed, but I'd then just fix the |
Compare against VERCEL_GIT_PREVIOUS_SHA when available so pushes with multiple commits do not miss earlier frontend changes. Fall back to HEAD^ when the previous deployment SHA is unavailable, and default to building when git history cannot be resolved instead of silently skipping the deploy. Also fix the allowlist entries for rspack.config.ts and the logo asset path, and drop config/ from the frontend trigger set because it does not affect Vercel previews. Co-Authored-By: OpenAI Codex <noreply@openai.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c7d70ca. Configure here.
Treat the full src/sentry/static/sentry/images tree as a frontend build input so preview deployments rebuild when shared assets like favicons change, not just when logo files change. Keep .vercelignore aligned with the same asset scope so the upload allowlist matches the ignoreCommand trigger set. Co-Authored-By: OpenAI Codex <noreply@openai.com>
Keep config/ out of the ignoreCommand trigger set, but continue uploading it to Vercel. The frontend build scripts reference files under config/, so removing the directory from .vercelignore can break preview builds even when config changes should not by themselves trigger a deployment. Co-Authored-By: OpenAI Codex <noreply@openai.com>
Drop the nested sh -c wrapper from ignoreCommand and keep the same diff logic inline. Vercel already evaluates ignoreCommand in a shell, so the extra wrapper only adds quoting complexity around the deployment gate. This preserves the deploy-base fallback and build-trigger allowlist while keeping the command closer to the original working shape. Co-Authored-By: OpenAI Codex <noreply@openai.com>
Keep vercel.json simple by moving the ignoreCommand logic into a checked-in shell script under build-utils/. This avoids fragile JSON escaping and keeps the deployment gate readable while preserving the same deploy-base fallback and frontend allowlist. Co-Authored-By: OpenAI Codex <noreply@openai.com>
|
🚨 Warning: This pull request contains Frontend and Backend changes! It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently. Have questions? Please ask in the |
Inline the ignoreCommand back into vercel.json and remove the helper script. This keeps the preview build gate easy to read while preserving the fixed frontend allowlist and the safe fallback of building when HEAD^ is unavailable. Co-Authored-By: OpenAI Codex <noreply@openai.com>
a6413c4 to
64b9a6e
Compare
Currently we have a Vercel build on every commit, which is quite expensive, especially when it's useless in cases when there are no frontend changes Add an `ignoreCommand` ([Vercel docs](https://vercel.com/docs/project-configuration/vercel-json#ignorecommand)) to `vercel.json` that checks whether any frontend-relevant files were modified in the pushed commit. When changes are limited to backend code (Python, Django, tests, etc.), Vercel skips the build entirely. The command exits `1` (build proceeds) when any of these paths changed: `static/`, `build-utils/`, `package.json`, `pnpm-lock.yaml`, `tsconfig.json`, `rspack.config.ts`, `vercel.json`, `.vercelignore`, or `config/`. It exits `0` (skip) otherwise. This matches the file allowlist already defined in `.vercelignore`, so the set of triggering paths mirrors what actually ends up in the Vercel build. --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: OpenAI Codex <noreply@openai.com>

Currently we have a Vercel build on every commit, which is quite expensive, especially when it's useless in cases when there are no frontend changes
Add an
ignoreCommand(Vercel docs) tovercel.jsonthat checks whether any frontend-relevant files were modified in the pushed commit. When changes are limited to backend code (Python, Django, tests, etc.), Vercel skips the build entirely.The command exits
1(build proceeds) when any of these paths changed:static/,build-utils/,package.json,pnpm-lock.yaml,tsconfig.json,rspack.config.ts,vercel.json,.vercelignore, orconfig/. It exits0(skip) otherwise.This matches the file allowlist already defined in
.vercelignore, so the set of triggering paths mirrors what actually ends up in the Vercel build.