diff --git a/.aiexclude b/.aiexclude index 05433f9baf75..a151af8a3db5 100644 --- a/.aiexclude +++ b/.aiexclude @@ -31,7 +31,6 @@ build.log google-services.json google-upload-credentials.json firebase.secrets.json -sentry.properties # Gradle files gradle.properties diff --git a/.configure b/.configure index adbab26505c7..88cf56cf5997 100644 --- a/.configure +++ b/.configure @@ -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 - }, { "file": "android/debug.keystore", "destination": "~/.configure/wordpress-android/secrets/debug_a8c.keystore", @@ -45,4 +35,4 @@ } ], "file_dependencies": [] -} \ No newline at end of file +} diff --git a/.configure-files/jetpack-sentry.properties.enc b/.configure-files/jetpack-sentry.properties.enc deleted file mode 100644 index 1fc3c05c3392..000000000000 Binary files a/.configure-files/jetpack-sentry.properties.enc and /dev/null differ diff --git a/.configure-files/sentry.properties.enc b/.configure-files/sentry.properties.enc deleted file mode 100644 index f35d8ad32e60..000000000000 Binary files a/.configure-files/sentry.properties.enc and /dev/null differ diff --git a/.configure-files/wordpress-sentry.properties.enc b/.configure-files/wordpress-sentry.properties.enc deleted file mode 100644 index fc8650de0f88..000000000000 --- a/.configure-files/wordpress-sentry.properties.enc +++ /dev/null @@ -1,5 +0,0 @@ -7"wyɏ1G.Ѳz.pP -\puf9ں lXsꞹ S5OAKԀ<ѷ)j4: -Iޏρ2((LXHi-)g_03ߘsUKw:UȠ -f㗥"2^Ma -1plj{s2 l GU罈XvC&΢"*::6I^gW\i2t!r9-9cq_-PwcvP40FuoHT1d*wMc-LQ \ No newline at end of file diff --git a/.gitignore b/.gitignore index 091575825c07..2b30b3ba7ea5 100644 --- a/.gitignore +++ b/.gitignore @@ -91,7 +91,6 @@ default.profraw /vendor /fastlane/promo_screenshots /fastlane/metadata/tmp -sentry.properties WordPress/release.jks WordPress/debug.keystore diff --git a/WordPress/build.gradle b/WordPress/build.gradle index 43fc9e7c5f09..8c285b9157e4 100644 --- a/WordPress/build.gradle +++ b/WordPress/build.gradle @@ -1,4 +1,5 @@ import io.sentry.android.gradle.extensions.InstrumentationFeature +import io.sentry.android.gradle.tasks.SentryCliExecTask plugins { alias(libs.plugins.android.application) @@ -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] @@ -83,6 +91,17 @@ sentry { telemetry = false } +tasks.withType(SentryCliExecTask).configureEach { + doFirst { + if (sentryAuthToken == null) { + throw new GradleException( + "SENTRY_AUTH_TOKEN is not set (or is blank). " + + "Set it to upload debug files to Sentry." + ) + } + } +} + allOpen { // allows mocking for classes w/o directly opening them for release builds annotation 'org.wordpress.android.testing.OpenClassAnnotation' diff --git a/WordPress/src/jetpack/sentry.properties b/WordPress/src/jetpack/sentry.properties new file mode 100644 index 000000000000..61905275736a --- /dev/null +++ b/WordPress/src/jetpack/sentry.properties @@ -0,0 +1,2 @@ +defaults.project=jetpack-android +defaults.org=a8c diff --git a/WordPress/src/wordpress/sentry.properties b/WordPress/src/wordpress/sentry.properties new file mode 100644 index 000000000000..159ccb1874d2 --- /dev/null +++ b/WordPress/src/wordpress/sentry.properties @@ -0,0 +1,2 @@ +defaults.project=wordpress-android +defaults.org=a8c diff --git a/fastlane/lanes/build.rb b/fastlane/lanes/build.rb index fff5b710d575..07d53dcfa927 100644 --- a/fastlane/lanes/build.rb +++ b/fastlane/lanes/build.rb @@ -482,7 +482,6 @@ 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'] @@ -490,7 +489,7 @@ def upload_gutenberg_sourcemaps(app:, release_version:) 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, project_slug: project_slug, version: release_version,