Skip to content

Use per-project Sentry configuration#4818

Merged
MiSikora merged 6 commits intomainfrom
mehow/task/sentry/config
Jan 23, 2026
Merged

Use per-project Sentry configuration#4818
MiSikora merged 6 commits intomainfrom
mehow/task/sentry/config

Conversation

@MiSikora
Copy link
Contributor

@MiSikora MiSikora commented Dec 3, 2025

Description

Currently, our builds upload data to our main Android Sentry project. Since we decided to split Android, Automotive, and Wear apps into separate ones, this now needs to be handled in the build system.

Our Sentry configuration is stored in the sentry.properties file. However, this file lives in the root project. I wasn’t able to find anything in the Sentry documentation indicating whether it’s possible to have multiple such files one in each sub-project or to define per-project properties within the root file.

To address this, I propose configuring everything through the Gradle plugin. This change will need to be accompanied by an update to the mobile-secrets repo to add the necessary properties. I can do it once we agree on the approach and sync the modifications in both repositories.

Relates to: https://linear.app/a8c/issue/AINFRA-1610/
Closes: PCDROID-401

Testing Instructions

I'm not sure if it is possible to test it really until we create a release build. But if anyone has an idea I'd like to know.

@MiSikora MiSikora added this to the 8.2 milestone Dec 3, 2025
Copilot AI review requested due to automatic review settings December 3, 2025 08:53
@MiSikora MiSikora requested a review from a team as a code owner December 3, 2025 08:53
@MiSikora MiSikora added the [Type] Tooling Related to the Gradle build scripts and the setup or maintenance of the project build process. label Dec 3, 2025
@MiSikora MiSikora requested review from geekygecko and removed request for a team December 3, 2025 08:53
@MiSikora MiSikora requested a review from a team December 3, 2025 08:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates Sentry configuration from a single sentry.properties file to per-project Gradle configuration, enabling separate Sentry projects for Android, Automotive, and Wear applications.

Key Changes

  • Added Sentry configuration properties (auth token, org, and project names) to dependencies.gradle.kts
  • Configured project-specific Sentry project names in each application module's build file
  • Renamed configureSentry() to applyCommonSentryConfiguration() and added auth token and org configuration
  • Added "prototype" to ignored build types for Sentry uploads

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
dependencies.gradle.kts Adds five new Sentry-related properties from secret properties: auth token, org, and three project names
build.gradle.kts Renames Sentry configuration function, adds auth token and org properties, includes "prototype" in ignored build types, removes unused import
app/build.gradle.kts Configures Android project-specific Sentry project name
automotive/build.gradle.kts Configures Automotive project-specific Sentry project name
wear/build.gradle.kts Configures Wear project-specific Sentry project name

Comment on lines +109 to +110
set("sentryAuthToken", secretProperties.getProperty("sentryAuthToken", ""))
set("sentryOrg", secretProperties.getProperty("sentryOrg", ""))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm not mistaken, those 2 properties as still in sentry.properties currently, not secret.properties.

  • So either we keep the sentry.properties file as-is (and also in .configure) and let the SentryPluginExtension automatically read those (at least I'm guessing that's who reads those implicitly so far) from sentry.properties, only overwriting the projectName via Gradle (assuming setting a sentry { … } section in the build.gradle.kts files doesn't disable SentryPluginExtension reading from sentry.properties implicitly, but instead adds on top of it so that the properties are merged?)
  • Or you plan to set those via Gradle as well like you do in your new applyCommonSentryConfiguration, and want to move secret values from sentry.properties to secrets.properties to have Gradle read from that .properties file instead… which could make sense too… but in that case I'd expect this PR to contain changes for the .configure-files/secrets.properties.enc, deletion of the .configure-files/sentry.properties.enc and removal of the entry for sentry.properties in the .configure JSON file to reflect that

PS: ICYMI, the convoluted/confusing way we currently use to manage/updates secrets in git repos with configure (and how to update the .enc files when you change secrets, etc) will very soon change to become way more simple and transparent (Internal ref: paaHJt-96q-p2). 🔜

Copy link
Contributor Author

@MiSikora MiSikora Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for bringing this up. This might have been unclear from the PR description but this is what I meant.

To address this, I propose configuring everything through the Gradle plugin. This change will need to be accompanied by an update to the mobile-secrets repo to add the necessary properties. I can do it once we agree on the approach and sync the modifications in both repositories.

I didn't want to update secrets in case the approach I'm proposing is incorrect. And yes, this approach means dropping sentry.properties.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, un-caffeinated me missed that part, thanks for highlighting it! Makes sense indeed.

If this PR is not extra-urgent and can wait a couple of days, maybe I can put PCAndroid as next on the list in my project to test our brand new way to manage in-repo secret files (AINFRA-1539).

Since that new approach to deal with in-repo secrets does not rely on .mobile-secrets nor .configure anymore, and instead transparently handles secret files via git's built-in filters feature, that means that any change you need to make on a secret files will then be done directly in the PCAndroid repo—and thus be part of the list of files changed in the PRs, with the contents of the secret file not being updated in main until the PR is merged there, like any other regular file, etc.
So once we adopt that new tool you wouldn't have the problem above in this PR anymore.

If you don't want to wait for me to migrate PCAndroid to the new tool and want to merge this PR earlier that's ok with me too, though in that case you'll indeed have to synchronize your merging of this PR with the push of changes to secret files in .mobile-secrets.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I think it can wait. I'd be great to test using git filters for that. I'll keep it open for now but as a draft. Thanks!

@MiSikora MiSikora marked this pull request as draft December 3, 2025 13:58
Copilot AI review requested due to automatic review settings December 4, 2025 14:12
@MiSikora MiSikora force-pushed the mehow/task/sentry/config branch from 0dfbdee to 4a0604d Compare December 4, 2025 14:12
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 5 changed files in this pull request and generated 6 comments.

@wpmobilebot wpmobilebot modified the milestones: 8.2, 8.3 Dec 8, 2025
@wpmobilebot
Copy link
Collaborator

Version 8.2 has now entered code-freeze, so the milestone of this PR has been updated to 8.3.

@AliSoftware
Copy link
Contributor

If this PR is not extra-urgent and can wait a couple of days, maybe I can put PCAndroid as next on the list in my project to test our brand new way to manage in-repo secret files (AINFRA-1539).

FYI: The PR to migrate this repo to git-conceal is now ready for review.

PS: Note that, timing-wise, I don't plan to merge it before mid-January (once I come back from AFK then the AI Workshop in NY) so that I can be around for support if needed and to help ease the adoption.

}

sentry {
projectName = project.findProperty("sentryWearProject")?.toString()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MiSikora question, just to double check: I don't think there should be differences related to what we do in annotate_sentry_mapping_uuid given we're building separate app bundles anyway (that is, each app will have its own base/assets/sentry-debug-meta.properties), right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question but I don't know. I would think that no changes are required since sentry.properties do not provide any other values.

@wpmobilebot wpmobilebot modified the milestones: 8.3, 8.4 Jan 6, 2026
@wpmobilebot
Copy link
Collaborator

Version 8.3 has now entered code-freeze, so the milestone of this PR has been updated to 8.4.

@wpmobilebot
Copy link
Collaborator

Version 8.4 has now entered code-freeze, so the milestone of this PR has been updated to 8.5.

Copilot AI review requested due to automatic review settings January 22, 2026 10:10
@MiSikora MiSikora force-pushed the mehow/task/sentry/config branch from ba61cf5 to 7b5971e Compare January 22, 2026 10:10
@MiSikora MiSikora marked this pull request as ready for review January 22, 2026 10:11
@MiSikora
Copy link
Contributor Author

MiSikora commented Jan 22, 2026

@AliSoftware @iangmaia The corresponding secrets update is available here: rMSb9db2ff98c1f-code. I did not remove the sentry.properties file yet to avoid blocking potential pull requests and releases before these changes are merged. After this PR is approved, I will follow up with another PR or append changes to this one to remove sentry.properties.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 7 changed files in this pull request and generated 1 comment.

Copy link
Contributor

@AliSoftware AliSoftware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked the ~/.mobile-secrets commit b9db2ff98c1fca8f638d5c96d77bb65ef737b6c6 and its changes to sentry.properties matched how properties are now read from that file in this PR, looks good to me.

I've also validated that the new pocket-casts-automotive and pocket-casts-wear projects already exist in Sentry (even if they're obviously empty right now.

I'm not sure if it is possible to test it really until we create a release build. But if anyone has an idea I'd like to know.

Yeah I'm not sure either. There might be some convoluted ways (e.g. tweak the code so that the project configures Sentry even on Prototype Builds—at least temporarily—then do a prototype build, force a crash on each device (Android, Automotive, Wear), and check… before undoing the tweak…) but I'm not sure it's worth the effort, compared to check it on the next release build? 🤔

@MiSikora
Copy link
Contributor Author

but I'm not sure it's worth the effort, compared to check it on the next release build?

Yeah, I don't think it is worth the effort. I'll proceed with removing sentry.properties now and merging this PR.

@MiSikora
Copy link
Contributor Author

MiSikora commented Jan 23, 2026

@AliSoftware When I removed the sentry.properties file and then tried to configure_update the process failed. I reverted the sentry.properties removal in the .mobile-secrets for now. Is removing files broken or am I doing something wrong?

bundler: failed to load command: fastlane (/Users/mehow/projects/pocket-casts-android/vendor/bundle/ruby/3.2.0/bin/fastlane)
/Users/mehow/projects/pocket-casts-android/vendor/bundle/ruby/3.2.0/gems/fastlane-plugin-wpmreleasetoolkit-13.8.1/lib/fastlane/plugin/wpmreleasetoolkit/models/file_reference.rb:39:in `read': No such file or directory @ rb_sysopen - /Users/mehow/.mobile-secrets/android/pocket-casts/sentry.properties (Errno::ENOENT)
	from /Users/mehow/projects/pocket-casts-android/vendor/bundle/ruby/3.2.0/gems/fastlane-plugin-wpmreleasetoolkit-13.8.1/lib/fastlane/plugin/wpmreleasetoolkit/models/file_reference.rb:39:in `update'
	from /Users/mehow/projects/pocket-casts-android/vendor/bundle/ruby/3.2.0/gems/fastlane-plugin-wpmreleasetoolkit-13.8.1/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_update_action.rb:39:in `each'
	from /Users/mehow/projects/pocket-casts-android/vendor/bundle/ruby/3.2.0/gems/fastlane-plugin-wpmreleasetoolkit-13.8.1/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_update_action.rb:39:in `run'
	from /Users/mehow/projects/pocket-casts-android/vendor/bundle/ruby/3.2.0/gems/fastlane-2.229.0/fastlane/lib/fastlane/runner.rb:263:in `block (2 levels) in execute_action'
	from /Users/mehow/projects/pocket-casts-android/vendor/bundle/ruby/3.2.0/gems/fastlane-2.229.0/fastlane/lib/fastlane/actions/actions_helper.rb:69:in `execute_action'
	from /Users/mehow/projects/pocket-casts-android/vendor/bundle/ruby/3.2.0/gems/fastlane-2.229.0/fastlane/lib/fastlane/runner.rb:255:in `block in execute_action'
	from /Users/mehow/projects/pocket-casts-android/vendor/bundle/ruby/3.2.0/gems/fastlane-2.229.0/fastlane/lib/fastlane/runner.rb:229:in `chdir'
	from /Users/mehow/projects/pocket-casts-android/vendor/bundle/ruby/3.2.0/gems/fastlane-2.229.0/fastlane/lib/fastlane/runner.rb:229:in `execute_action'
	from /Users/mehow/projects/pocket-casts-android/vendor/bundle/ruby/3.2.0/gems/fastlane-2.229.0/fastlane/lib/fastlane/one_off.rb:42:in `run'
	from /Users/mehow/projects/pocket-casts-android/vendor/bundle/ruby/3.2.0/gems/fastlane-2.229.0/fastlane/lib/fastlane/one_off.rb:22:in `execute'
	from /Users/mehow/projects/pocket-casts-android/vendor/bundle/ruby/3.2.0/gems/fastlane-2.229.0/fastlane/lib/fastlane/commands_generator.rb:226:in `block (2 levels) in run'
	from /Users/mehow/projects/pocket-casts-android/vendor/bundle/ruby/3.2.0/gems/commander-4.6.0/lib/commander/command.rb:187:in `call'
	from /Users/mehow/projects/pocket-casts-android/vendor/bundle/ruby/3.2.0/gems/commander-4.6.0/lib/commander/command.rb:157:in `run'
	from /Users/mehow/projects/pocket-casts-android/vendor/bundle/ruby/3.2.0/gems/commander-4.6.0/lib/commander/runner.rb:444:in `run_active_command'
	from /Users/mehow/projects/pocket-casts-android/vendor/bundle/ruby/3.2.0/gems/fastlane-2.229.0/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb:124:in `run!'
	from /Users/mehow/projects/pocket-casts-android/vendor/bundle/ruby/3.2.0/gems/commander-4.6.0/lib/commander/delegates.rb:18:in `run!'
	from /Users/mehow/projects/pocket-casts-android/vendor/bundle/ruby/3.2.0/gems/fastlane-2.229.0/fastlane/lib/fastlane/commands_generator.rb:363:in `run'
	from /Users/mehow/projects/pocket-casts-android/vendor/bundle/ruby/3.2.0/gems/fastlane-2.229.0/fastlane/lib/fastlane/commands_generator.rb:43:in `start'
	from /Users/mehow/projects/pocket-casts-android/vendor/bundle/ruby/3.2.0/gems/fastlane-2.229.0/fastlane/lib/fastlane/cli_tools_distributor.rb:123:in `take_off'
	from /Users/mehow/projects/pocket-casts-android/vendor/bundle/ruby/3.2.0/gems/fastlane-2.229.0/bin/fastlane:23:in `<top (required)>'
	from /Users/mehow/projects/pocket-casts-android/vendor/bundle/ruby/3.2.0/bin/fastlane:25:in `load'
	from /Users/mehow/projects/pocket-casts-android/vendor/bundle/ruby/3.2.0/bin/fastlane:25:in `<top (required)>'
	from /Users/mehow/projects/pocket-casts-android/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.21/lib/bundler/cli/exec.rb:58:in `load'
	from /Users/mehow/projects/pocket-casts-android/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.21/lib/bundler/cli/exec.rb:58:in `kernel_load'
	from /Users/mehow/projects/pocket-casts-android/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.21/lib/bundler/cli/exec.rb:23:in `run'
	from /Users/mehow/projects/pocket-casts-android/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.21/lib/bundler/cli.rb:492:in `exec'
	from /Users/mehow/projects/pocket-casts-android/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.21/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
	from /Users/mehow/projects/pocket-casts-android/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.21/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
	from /Users/mehow/projects/pocket-casts-android/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.21/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
	from /Users/mehow/projects/pocket-casts-android/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.21/lib/bundler/cli.rb:34:in `dispatch'
	from /Users/mehow/projects/pocket-casts-android/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.21/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
	from /Users/mehow/projects/pocket-casts-android/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.21/lib/bundler/cli.rb:28:in `start'
	from /Users/mehow/projects/pocket-casts-android/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.21/exe/bundle:37:in `block in <top (required)>'
	from /Users/mehow/projects/pocket-casts-android/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.21/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
	from /Users/mehow/projects/pocket-casts-android/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.21/exe/bundle:29:in `<top (required)>'
	from /Users/mehow/.rbenv/versions/3.2.2/bin/bundle:25:in `load'
	from /Users/mehow/.rbenv/versions/3.2.2/bin/bundle:25:in `<main>'

@AliSoftware
Copy link
Contributor

@MiSikora You need to remove the entry about sentry.properties from the .configure JSON file: https://github.com/Automattic/pocket-casts-android/pull/4818/changes#diff-d9f4fe594e0cc13185842eb7b4d58264651fb136e5e1a2f2cc46b6be61d5a211R11-R15

(Which is the config file that configure_apply uses to know which files to copy from ~/.mobile-secrets into your repo)

.configure Outdated
Comment on lines 11 to 15
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those lines to be deleted once you'll delete the sentry.properties file from ~/.mobile-secrets so that running configure_apply does not try to copy it anymore.

@MiSikora MiSikora merged commit 2a7da69 into main Jan 23, 2026
18 checks passed
@MiSikora MiSikora deleted the mehow/task/sentry/config branch January 23, 2026 15:08
MiSikora added a commit that referenced this pull request Jan 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Area] Tooling [Type] Tooling Related to the Gradle build scripts and the setup or maintenance of the project build process.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants