Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .aiexclude
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ build.log
google-services.json
google-upload-credentials.json
firebase.secrets.json
sentry.properties

# Gradle files
gradle.properties
Expand Down
12 changes: 1 addition & 11 deletions .configure
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,6 @@
"destination": "WordPress/google-services.json",
"encrypt": true
},
{
"file": "android/WPAndroid/wordpress-sentry.properties",
"destination": "WordPress/src/wordpress/sentry.properties",
"encrypt": true
},
{
"file": "android/WPAndroid/jetpack-sentry.properties",
"destination": "WordPress/src/jetpack/sentry.properties",
"encrypt": true
},

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Notice no sentry.properties entry was removed. I haven't followed up with the Git history but it seems likely to me that the file was there in the pre-Jetpack days and was not deleted at the time of the fork.

{
"file": "android/debug.keystore",
"destination": "~/.configure/wordpress-android/secrets/debug_a8c.keystore",
Expand All @@ -45,4 +35,4 @@
}
],
"file_dependencies": []
}
}
Binary file removed .configure-files/jetpack-sentry.properties.enc
Binary file not shown.
Binary file removed .configure-files/sentry.properties.enc
Binary file not shown.
5 changes: 0 additions & 5 deletions .configure-files/wordpress-sentry.properties.enc

This file was deleted.

1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ default.profraw
/vendor
/fastlane/promo_screenshots
/fastlane/metadata/tmp
sentry.properties

WordPress/release.jks
WordPress/debug.keystore
Expand Down
19 changes: 19 additions & 0 deletions WordPress/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import io.sentry.android.gradle.extensions.InstrumentationFeature
import io.sentry.android.gradle.tasks.SentryCliExecTask

plugins {
alias(libs.plugins.android.application)
Expand Down Expand Up @@ -64,7 +65,14 @@ static String pathForSmartFlankGcsPath(String app) {
return "gs://fladle/wordpress-android/${app}/smart-flank/JUnitReport.xml"
}

// A secret-injection step that resolves to nothing exports an empty SENTRY_AUTH_TOKEN rather
// than leaving it unset, so treat blank as missing — otherwise the guard below passes and
// sentry-cli fails mid-upload with an opaque auth error.
def sentryAuthToken = providers.environmentVariable("SENTRY_AUTH_TOKEN").orNull?.trim() ?: null

sentry {
authToken = sentryAuthToken

tracingInstrumentation {
enabled = true
features = [InstrumentationFeature.DATABASE]
Expand All @@ -83,6 +91,17 @@ sentry {
telemetry = false
}

tasks.withType(SentryCliExecTask).configureEach {
doFirst {
if (sentryAuthToken == null) {
throw new GradleException(
Comment on lines +94 to +97

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we have to do this here and not on line 71? Is there any advantage to rely on SentryCliExecTask?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ah okay, I think I know why: you don't want to validate when just configuring the build (so it's possible to run build without secrets) but only fail on missing token when someone calls a Sentry task, makes sense

"SENTRY_AUTH_TOKEN is not set (or is blank). " +
"Set it to upload debug files to Sentry."
)
}
}
Comment thread
Copilot marked this conversation as resolved.
}

allOpen {
// allows mocking for classes w/o directly opening them for release builds
annotation 'org.wordpress.android.testing.OpenClassAnnotation'
Expand Down
2 changes: 2 additions & 0 deletions WordPress/src/jetpack/sentry.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
defaults.project=jetpack-android
defaults.org=a8c
2 changes: 2 additions & 0 deletions WordPress/src/wordpress/sentry.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
defaults.project=wordpress-android
defaults.org=a8c
3 changes: 1 addition & 2 deletions fastlane/lanes/build.rb
Original file line number Diff line number Diff line change
Expand Up @@ -482,15 +482,14 @@ def upload_gutenberg_sourcemaps(app:, release_version:)
# Load Sentry properties
sentry_path = File.join(PROJECT_ROOT_FOLDER, 'WordPress', 'src', app.downcase, 'sentry.properties')
sentry_properties = JavaProperties.load(sentry_path)
sentry_token = sentry_properties[:'auth.token']
project_slug = sentry_properties[:'defaults.project']
org_slug = sentry_properties[:'defaults.org']

# Bundle and source map files are copied to a specific folder as part of the build process.
bundle_source_map_path = File.join(PROJECT_ROOT_FOLDER, 'WordPress', 'build', 'react-native-bundle-source-map')

sentry_upload_sourcemap(
auth_token: sentry_token,
auth_token: get_required_env('SENTRY_AUTH_TOKEN'),
org_slug: org_slug,
Comment on lines 491 to 493
project_slug: project_slug,
version: release_version,
Expand Down
Loading