From 82c4a5f7aed0616bd70f7564d6364e42d0aa213e Mon Sep 17 00:00:00 2001 From: Jack Berg Date: Wed, 7 Jun 2023 15:41:45 -0500 Subject: [PATCH 1/2] Publish build scans to ge.opentelemetry.io --- settings.gradle.kts | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/settings.gradle.kts b/settings.gradle.kts index 561f96dc76f..529d82e2547 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -62,15 +62,42 @@ include(":sdk-extensions:incubator") include(":sdk-extensions:jaeger-remote-sampler") include(":testing-internal") +val gradleEnterpriseServer = "https://ge.opentelemetry.io" val isCI = System.getenv("CI") != null -gradleEnterprise { - buildScan { - termsOfServiceUrl = "https://gradle.com/terms-of-service" - termsOfServiceAgree = "yes" +val geAccessKey = System.getenv("GRADLE_ENTERPRISE_ACCESS_KEY") ?: "" - if (isCI) { +// if GE access key is not given and we are in CI, then we publish to scans.gradle.com +val useScansGradleCom = isCI && geAccessKey.isEmpty() + +if (useScansGradleCom) { + gradleEnterprise { + buildScan { + termsOfServiceUrl = "https://gradle.com/terms-of-service" + termsOfServiceAgree = "yes" + isUploadInBackground = !isCI + publishAlways() + + capture { + isTaskInputFiles = true + } + } + } +} else { + gradleEnterprise { + server = gradleEnterpriseServer + buildScan { + isUploadInBackground = !isCI + + this as com.gradle.enterprise.gradleplugin.internal.extension.BuildScanExtensionWithHiddenFeatures + publishIfAuthenticated() publishAlways() - tag("CI") + + capture { + isTaskInputFiles = true + } + + gradle.startParameter.projectProperties["testJavaVersion"]?.let { tag(it) } + gradle.startParameter.projectProperties["testJavaVM"]?.let { tag(it) } } } } From a99e7a3d061b112c39e7cece46dbf4ffe9805d6f Mon Sep 17 00:00:00 2001 From: Jack Berg Date: Wed, 7 Jun 2023 19:55:46 -0500 Subject: [PATCH 2/2] Add gradle enterprise key --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c3dfcc84026..01019ddebaa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -56,6 +56,8 @@ jobs: ${{ matrix.coverage && 'jacocoTestReport' || '' }} -PtestJavaVersion=${{ matrix.test-java-version }} -Porg.gradle.java.installations.paths=${{ steps.setup-java-test.outputs.path }},${{ steps.setup-java.outputs.path }} + env: + GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} - name: Check for diff # The jApiCmp diff compares current to latest, which isn't appropriate for release branches