Skip to content

Commit

Permalink
Retrieve org from extension, disable telemetry on CI (#599)
Browse files Browse the repository at this point in the history
  • Loading branch information
romtsn authored Nov 28, 2023
1 parent 528f265 commit 8634419
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test-matrix-agp-gradle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ jobs:
with:
cache-read-only: ${{ github.ref != 'refs/heads/main' }}
gradle-version: ${{ matrix.gradle }}
gradle-home-cache-excludes: |
caches/transforms-3
arguments: integrationTest

- name: Upload Test Results
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Fixes

- Retrieve `sentryOrg` from the `SentryPluginExtension` for telemetry ([#599](https://github.com/getsentry/sentry-android-gradle-plugin/pull/599))

### Dependencies

- Bump CLI from v2.21.5 to v2.22.3 ([#598](https://github.com/getsentry/sentry-android-gradle-plugin/pull/598), [#600](https://github.com/getsentry/sentry-android-gradle-plugin/pull/600))
Expand Down
1 change: 1 addition & 0 deletions buildSrc/src/main/java/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ object Libs {
}

object CI {
const val SENTRY_SDKS_DSN = "https://dd1f82ad30a331bd7def2a0dce926c6e@o447951.ingest.sentry.io/4506031723446272"
fun canAutoUpload(): Boolean {
return System.getenv("AUTO_UPLOAD").toBoolean() &&
!System.getenv("SENTRY_AUTH_TOKEN").isNullOrEmpty()
Expand Down
1 change: 1 addition & 0 deletions examples/android-gradle-kts/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ android {
sentry {
autoUploadProguardMapping.set(CI.canAutoUpload())

telemetryDsn.set(CI.SENTRY_SDKS_DSN)
tracingInstrumentation {
enabled.set(false)
}
Expand Down
1 change: 1 addition & 0 deletions examples/android-gradle/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ android {
sentry {
autoUploadProguardMapping = CI.INSTANCE.canAutoUpload()

telemetryDsn = CI.INSTANCE.SENTRY_SDKS_DSN
tracingInstrumentation {
enabled = false
}
Expand Down
1 change: 1 addition & 0 deletions examples/android-guardsquare-proguard/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ sentry {

dexguardEnabled = true

telemetryDsn = CI.INSTANCE.SENTRY_SDKS_DSN
tracingInstrumentation {
enabled = false
}
Expand Down
4 changes: 4 additions & 0 deletions examples/android-instrumentation-sample/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ sentry {
autoUploadSourceContext.set(CI.canAutoUpload())
additionalSourceDirsForSourceContext.set(setOf("src/custom/java"))

org.set("sentry-sdks")
projectName.set("sentry-android")
telemetryDsn.set(CI.SENTRY_SDKS_DSN)

tracingInstrumentation {
forceInstrumentDependencies.set(true)
}
Expand Down
2 changes: 0 additions & 2 deletions examples/android-instrumentation-sample/sentry.properties

This file was deleted.

1 change: 1 addition & 0 deletions examples/android-ndk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ if (System.getenv("AUTO_UPLOAD")) {
includeNativeSources = true
autoUploadNativeSymbols = CI.INSTANCE.canAutoUpload()

telemetryDsn = CI.INSTANCE.SENTRY_SDKS_DSN
tracingInstrumentation {
enabled = false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,11 @@ abstract class SentryTelemetryService :

hub.configureScope { scope ->
scope.user = User().also { user ->
startParameters.defaultSentryOrganization?.let { user.id = it }
startParameters.defaultSentryOrganization?.let { org ->
if (org != "-") {
user.id = org
}
}
startParameters.sentryOrganization?.let { user.id = it }
}
}
Expand Down Expand Up @@ -245,22 +249,23 @@ abstract class SentryTelemetryService :
buildType: String
): SentryTelemetryServiceParams {
val tags = extraTagsFromExtension(project, extension)
val org = sentryOrg ?: extension.org.orNull

if (isExecAvailable()) {
return paramsWithExecAvailable(
project,
cliExecutable,
extension,
variant,
sentryOrg,
org,
buildType,
tags
)
} else {
return SentryTelemetryServiceParams(
extension.telemetry.get(),
extension.telemetryDsn.get(),
sentryOrg,
org,
buildType,
tags,
extension.debug.get(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ sentry {
autoInstallation {
enabled = false
}
telemetry = false
}

0 comments on commit 8634419

Please sign in to comment.