diff --git a/.github/repository-settings.md b/.github/repository-settings.md index 5a67637c6c90..66be1268779c 100644 --- a/.github/repository-settings.md +++ b/.github/repository-settings.md @@ -68,10 +68,6 @@ for [`dependabot/**/**`](https://github.com/open-telemetry/community/blob/main/d - `GPG_PASSWORD` - stored in OpenTelemetry-Java 1Password - `GPG_PRIVATE_KEY` - stored in OpenTelemetry-Java 1Password -- `GRADLE_ENTERPRISE_ACCESS_KEY` - owned by [@trask](https://github.com/trask) - - Generated at https://ge.opentelemetry.io > My settings > Access keys - - Format of env var is `ge.opentelemetry.io=`, - see [docs](https://docs.gradle.com/enterprise/gradle-plugin/#via_environment_variable) - `GRADLE_PUBLISH_KEY` - `GRADLE_PUBLISH_SECRET` - `NVD_API_KEY` - stored in OpenTelemetry-Java 1Password diff --git a/.github/workflows/build-common.yml b/.github/workflows/build-common.yml index d222dd15dab4..ae12e9456022 100644 --- a/.github/workflows/build-common.yml +++ b/.github/workflows/build-common.yml @@ -9,15 +9,15 @@ on: no-build-cache: type: boolean required: false + max-test-retries: + type: string + required: false skip-openj9-tests: type: boolean required: false skip-windows-smoke-tests: type: boolean required: false - secrets: - GRADLE_ENTERPRISE_ACCESS_KEY: - required: false permissions: contents: read @@ -45,8 +45,6 @@ jobs: gradle-home-cache-excludes: caches/build-cache-1 - name: Spotless - env: - GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} run: ./gradlew spotlessCheck ${{ inputs.no-build-cache && '--no-build-cache' || '' }} gradle-wrapper-validation: @@ -78,8 +76,6 @@ jobs: gradle-home-cache-excludes: caches/build-cache-1 - name: Generate license report - env: - GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} run: ./gradlew generateLicenseReport ${{ inputs.no-build-cache && '--no-build-cache' || '' }} - name: Check licenses @@ -149,8 +145,6 @@ jobs: gradle-home-cache-excludes: caches/build-cache-1 - name: Build - env: - GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} # javadoc task fails sporadically fetching https://docs.oracle.com/javase/8/docs/api/ run: ./gradlew check spdxSbom -x javadoc -x spotlessCheck -PskipTests=true ${{ inputs.no-build-cache && '--no-build-cache' || '' }} @@ -253,8 +247,6 @@ jobs: gradle-home-cache-excludes: caches/build-cache-1 - name: List tests - env: - GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} # "check" is needed to activate all tests for listing purposes # listTestsInPartition writes test tasks that apply to the given partition to a file named # "test-tasks.txt" and then disables all tasks (including tests) after it runs @@ -269,8 +261,6 @@ jobs: echo "test-tasks=$(cat test-tasks.txt | xargs echo | sed 's/\n/ /g')" >> $GITHUB_ENV - name: Test - env: - GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} # spotless is checked separately since it's a common source of failure run: > ./gradlew @@ -280,6 +270,7 @@ jobs: -Porg.gradle.java.installations.paths=${{ steps.setup-test-java.outputs.path }} -Porg.gradle.java.installations.auto-download=false ${{ inputs.no-build-cache && ' --no-build-cache' || '' }} + ${{ inputs.max-test-retries && format(' -PmaxTestRetries={0}', inputs.max-test-retries) || '' }} - name: Build scan if: ${{ !cancelled() && hashFiles('build-scan.txt') != '' }} @@ -352,14 +343,10 @@ jobs: gradle-home-cache-excludes: caches/build-cache-1 - name: Build - env: - GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} # running suite "none" compiles everything needed by smoke tests without executing any tests run: ./gradlew :smoke-tests:test -PsmokeTestSuite=none --no-daemon ${{ inputs.no-build-cache && ' --no-build-cache' || '' }} - name: Test - env: - GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} run: ./gradlew :smoke-tests:test -PsmokeTestSuite=${{ matrix.smoke-test-suite }}${{ inputs.no-build-cache && ' --no-build-cache' || '' }} - name: Upload jvm crash dump files if any diff --git a/.github/workflows/build-daily-no-build-cache.yml b/.github/workflows/build-daily-no-build-cache.yml index 5517e0426ee2..596b46773834 100644 --- a/.github/workflows/build-daily-no-build-cache.yml +++ b/.github/workflows/build-daily-no-build-cache.yml @@ -10,16 +10,20 @@ jobs: common: uses: ./.github/workflows/build-common.yml with: + max-test-retries: 0 no-build-cache: true - secrets: - GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} test-latest-deps: uses: ./.github/workflows/reusable-test-latest-deps.yml with: + max-test-retries: 0 + no-build-cache: true + + test-indy: + uses: ./.github/workflows/reusable-test-indy.yml + with: + max-test-retries: 0 no-build-cache: true - secrets: - GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} # muzzle is not included here because it doesn't use gradle cache anyway and so is already covered # by the normal daily build diff --git a/.github/workflows/build-daily.yml b/.github/workflows/build-daily.yml index c3e48c72cbdc..2e6aae3033bc 100644 --- a/.github/workflows/build-daily.yml +++ b/.github/workflows/build-daily.yml @@ -9,13 +9,18 @@ on: jobs: common: uses: ./.github/workflows/build-common.yml - secrets: - GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + with: + max-test-retries: 0 test-latest-deps: uses: ./.github/workflows/reusable-test-latest-deps.yml - secrets: - GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + with: + max-test-retries: 0 + + test-indy: + uses: ./.github/workflows/reusable-test-indy.yml + with: + max-test-retries: 0 muzzle: uses: ./.github/workflows/reusable-muzzle.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e49db0d7eb67..e164f682eb89 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,8 +10,6 @@ on: jobs: common: uses: ./.github/workflows/build-common.yml - secrets: - GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} test-latest-deps: # release branches are excluded @@ -19,8 +17,6 @@ jobs: # which requires unnecessary release branch maintenance, especially for patches if: "!startsWith(github.ref_name, 'release/')" uses: ./.github/workflows/reusable-test-latest-deps.yml - secrets: - GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} muzzle: # release branches are excluded @@ -80,7 +76,6 @@ jobs: - name: Build and publish artifact snapshots env: - GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} SONATYPE_USER: ${{ secrets.SONATYPE_USER }} SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }} GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} @@ -89,7 +84,6 @@ jobs: - name: Build and publish gradle plugin snapshots env: - GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} SONATYPE_USER: ${{ secrets.SONATYPE_USER }} SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }} GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} diff --git a/.github/workflows/reusable-test-indy.yml b/.github/workflows/reusable-test-indy.yml index edde70c6baa5..ab085def4ee0 100644 --- a/.github/workflows/reusable-test-indy.yml +++ b/.github/workflows/reusable-test-indy.yml @@ -9,8 +9,8 @@ on: no-build-cache: type: boolean required: false - secrets: - GRADLE_ENTERPRISE_ACCESS_KEY: + max-test-retries: + type: string required: false permissions: @@ -65,8 +65,6 @@ jobs: gradle-home-cache-excludes: caches/build-cache-1 - name: List tests - env: - GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} run: > ./gradlew check -x spotlessCheck @@ -78,13 +76,12 @@ jobs: echo "test-tasks=$(cat test-tasks.txt | xargs echo | sed 's/\n/ /g')" >> $GITHUB_ENV - name: Test - env: - GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} run: > ./gradlew ${{ env.test-tasks }} -PtestIndy=true ${{ inputs.no-build-cache && ' --no-build-cache' || '' }} + ${{ inputs.max-test-retries && format(' -PmaxTestRetries={0}', inputs.max-test-retries) || '' }} - name: Build scan if: ${{ !cancelled() && hashFiles('build-scan.txt') != '' }} diff --git a/.github/workflows/reusable-test-latest-deps.yml b/.github/workflows/reusable-test-latest-deps.yml index db227729f7ee..3c30ec2515ae 100644 --- a/.github/workflows/reusable-test-latest-deps.yml +++ b/.github/workflows/reusable-test-latest-deps.yml @@ -9,8 +9,8 @@ on: no-build-cache: type: boolean required: false - secrets: - GRADLE_ENTERPRISE_ACCESS_KEY: + max-test-retries: + type: string required: false permissions: @@ -62,8 +62,6 @@ jobs: gradle-home-cache-excludes: caches/build-cache-1 - name: List tests - env: - GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} run: > ./gradlew check -x spotlessCheck @@ -76,13 +74,12 @@ jobs: echo "test-tasks=$(cat test-tasks.txt | xargs echo | sed 's/\n/ /g')" >> $GITHUB_ENV - name: Test - env: - GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} run: > ./gradlew ${{ env.test-tasks }} -PtestLatestDeps=true ${{ inputs.no-build-cache && ' --no-build-cache' || '' }} + ${{ inputs.max-test-retries && format(' -PmaxTestRetries={0}', inputs.max-test-retries) || '' }} - name: Build scan if: ${{ !cancelled() && hashFiles('build-scan.txt') != '' }} diff --git a/conventions/src/main/kotlin/otel.java-conventions.gradle.kts b/conventions/src/main/kotlin/otel.java-conventions.gradle.kts index df274dfc5117..576aed6cd7c4 100644 --- a/conventions/src/main/kotlin/otel.java-conventions.gradle.kts +++ b/conventions/src/main/kotlin/otel.java-conventions.gradle.kts @@ -366,11 +366,12 @@ tasks.withType().configureEach { // This value is quite big because with lower values (3 mins) we were experiencing large number of false positives timeout.set(Duration.ofMinutes(15)) + val defaultMaxRetries = if (System.getenv().containsKey("CI")) 5 else 0 + val maxTestRetries = gradle.startParameter.projectProperties["maxTestRetries"]?.toInt() ?: defaultMaxRetries + develocity.testRetry { // You can see tests that were retried by this mechanism in the collected test reports and build scans. - if (System.getenv().containsKey("CI") || rootProject.hasProperty("retryTests")) { - maxRetries.set(5) - } + maxRetries.set(maxTestRetries); } reports { diff --git a/settings.gradle.kts b/settings.gradle.kts index 67ff589c2439..f3a17f03591a 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -13,7 +13,6 @@ pluginManagement { } plugins { - id("com.gradle.develocity") version "3.18.2" id("com.gradle.common-custom-user-data-gradle-plugin") version "2.0.2" id("org.gradle.toolchains.foojay-resolver-convention") version "0.9.0" // this can't live in pluginManagement currently due to @@ -22,6 +21,7 @@ plugins { // ./gradlew :smoke-tests:images:servlet:buildLinuxTestImages pushMatrix -PsmokeTestServer=jetty // ./gradlew :smoke-tests:images:servlet:buildWindowsTestImages pushMatrix -PsmokeTestServer=jetty id("com.bmuschko.docker-remote-api") version "9.4.0" apply false + id("com.gradle.develocity") version "3.18.2" } dependencyResolutionManagement { @@ -48,64 +48,11 @@ dependencyResolutionManagement { } } -val gradleEnterpriseServer = "https://ge.opentelemetry.io" -val isCI = System.getenv("CI") != null -val geAccessKey = System.getenv("GRADLE_ENTERPRISE_ACCESS_KEY") ?: "" - -// 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) { - develocity { - buildScan { - termsOfUseUrl = "https://gradle.com/help/legal-terms-of-use" - termsOfUseAgree = "yes" - uploadInBackground = !isCI - - capture { - fileFingerprints = true - } - - if (!gradle.startParameter.taskNames.contains("listTestsInPartition")) { - buildScanPublished { - File("build-scan.txt").printWriter().use { writer -> - writer.println(buildScanUri) - } - } - } - } - } -} else { - develocity { - server = gradleEnterpriseServer - buildScan { - uploadInBackground = !isCI - publishing.onlyIf { it.isAuthenticated } - - capture { - fileFingerprints = true - } - - gradle.startParameter.projectProperties["testJavaVersion"]?.let { tag(it) } - gradle.startParameter.projectProperties["testJavaVM"]?.let { tag(it) } - gradle.startParameter.projectProperties["smokeTestSuite"]?.let { - value("Smoke test suite", it) - } - - if (!gradle.startParameter.taskNames.contains("listTestsInPartition")) { - buildScanPublished { - File("build-scan.txt").printWriter().use { writer -> - writer.println(buildScanUri) - } - } - } - } - } - - buildCache { - remote(develocity.buildCache) { - isPush = isCI && geAccessKey.isNotEmpty() - } +develocity { + buildScan { + publishing.onlyIf { System.getenv("CI") != null } + termsOfUseUrl.set("https://gradle.com/help/legal-terms-of-use") + termsOfUseAgree.set("yes") } }