feat(core): Support SENTRY_RELEASE and SENTRY_DIST env vars in build scripts#6070
Merged
feat(core): Support SENTRY_RELEASE and SENTRY_DIST env vars in build scripts#6070
Conversation
…scripts The build scripts (`sentry-xcode.sh` and `sentry.gradle`) already support overriding `environment` in `sentry.options.json` via `SENTRY_ENVIRONMENT`. This extends the same pattern to `SENTRY_RELEASE` and `SENTRY_DIST`. When using native auto-init, users with custom release formats in `Sentry.init()` need a way to set matching values in the options file at build time to avoid split releases (pre-JS crashes on one release, post-JS events on another). These env vars are already used by `sentry-cli` for source maps upload, so setting them now aligns both source maps and native init in one step. Closes #6069 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
6 tasks
Contributor
Semver Impact of This PR⚪ None (no version bump detected) 📋 Changelog PreviewThis is how your changes will appear in the changelog.
Plus 2 more 🤖 This preview updates automatically when you update the PR. |
Contributor
|
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Author
|
@sentry review |
Contributor
Author
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 00db39c. Configure here.
lucas-zimerman
approved these changes
Apr 29, 2026
Collaborator
lucas-zimerman
left a comment
There was a problem hiding this comment.
Nice little fix!
3 tasks
antonis
added a commit
to getsentry/sentry-docs
that referenced
this pull request
Apr 30, 2026
…upport (#17546) ## DESCRIBE YOUR PR Documents the `SENTRY_RELEASE` and `SENTRY_DIST` build-time environment variable overrides for `sentry.options.json` in the app-start-error-capture guide.⚠️ Based on #17540 **Changes:** - Added "Setting Release and Distribution" env var usage with CLI example - Updated EAS Build profiles example to include `SENTRY_RELEASE` and `SENTRY_DIST`⚠️ Should be merged after getsentry/sentry-react-native#6070 ships ## IS YOUR CHANGE URGENT? - [ ] Urgent deadline (GA date, etc.) - [ ] Other deadline - [x] None: Not urgent, can wait up to 1 week+ ## PRE-MERGE CHECKLIST - [ ] Checked Vercel preview for correctness, including links - [ ] PR was reviewed and approved by any necessary SMEs (subject matter experts) - [ ] PR was reviewed and approved by a member of the [Sentry docs team](https://github.com/orgs/getsentry/teams/docs) --------- Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📢 Type of change
📜 Description
Extends
sentry-xcode.shandsentry.gradleto supportSENTRY_RELEASEandSENTRY_DISTenvironment variables for overriding values insentry.options.jsonat build time, following the existingSENTRY_ENVIRONMENTpattern.When using native auto-init (
RNSentrySDK.start()/useNativeInit), users with customreleaseformats inSentry.init()end up with two releases in Sentry — one from native init (auto-detected) and one from JS init (custom). This gives them a build-time mechanism to align both.These env vars are already used by
sentry-clifor source maps upload in the same build scripts, so setting them now aligns both source maps and native init in one step.💡 Motivation and Context
Closes #6069
Related: #6064
💚 How did you test it?
Added tests for the iOS xcode script covering:
No gradle tests exist in the repo (pre-existing).
📝 Checklist
sendDefaultPIIis enabled🔮 Next steps