Skip to content

Commit 80ccda1

Browse files
authored
Update develocity config (#12835)
1 parent c2c5d80 commit 80ccda1

9 files changed

+37
-109
lines changed

.github/repository-settings.md

-4
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,6 @@ for [`dependabot/**/**`](https://github.com/open-telemetry/community/blob/main/d
6868

6969
- `GPG_PASSWORD` - stored in OpenTelemetry-Java 1Password
7070
- `GPG_PRIVATE_KEY` - stored in OpenTelemetry-Java 1Password
71-
- `GRADLE_ENTERPRISE_ACCESS_KEY` - owned by [@trask](https://github.com/trask)
72-
- Generated at https://ge.opentelemetry.io > My settings > Access keys
73-
- Format of env var is `ge.opentelemetry.io=<access key>`,
74-
see [docs](https://docs.gradle.com/enterprise/gradle-plugin/#via_environment_variable)
7571
- `GRADLE_PUBLISH_KEY`
7672
- `GRADLE_PUBLISH_SECRET`
7773
- `NVD_API_KEY` - stored in OpenTelemetry-Java 1Password

.github/workflows/build-common.yml

+4-17
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ on:
99
no-build-cache:
1010
type: boolean
1111
required: false
12+
max-test-retries:
13+
type: string
14+
required: false
1215
skip-openj9-tests:
1316
type: boolean
1417
required: false
1518
skip-windows-smoke-tests:
1619
type: boolean
1720
required: false
18-
secrets:
19-
GRADLE_ENTERPRISE_ACCESS_KEY:
20-
required: false
2121

2222
permissions:
2323
contents: read
@@ -45,8 +45,6 @@ jobs:
4545
gradle-home-cache-excludes: caches/build-cache-1
4646

4747
- name: Spotless
48-
env:
49-
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
5048
run: ./gradlew spotlessCheck ${{ inputs.no-build-cache && '--no-build-cache' || '' }}
5149

5250
gradle-wrapper-validation:
@@ -78,8 +76,6 @@ jobs:
7876
gradle-home-cache-excludes: caches/build-cache-1
7977

8078
- name: Generate license report
81-
env:
82-
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
8379
run: ./gradlew generateLicenseReport ${{ inputs.no-build-cache && '--no-build-cache' || '' }}
8480

8581
- name: Check licenses
@@ -149,8 +145,6 @@ jobs:
149145
gradle-home-cache-excludes: caches/build-cache-1
150146

151147
- name: Build
152-
env:
153-
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
154148
# javadoc task fails sporadically fetching https://docs.oracle.com/javase/8/docs/api/
155149
run: ./gradlew check spdxSbom -x javadoc -x spotlessCheck -PskipTests=true ${{ inputs.no-build-cache && '--no-build-cache' || '' }}
156150

@@ -253,8 +247,6 @@ jobs:
253247
gradle-home-cache-excludes: caches/build-cache-1
254248

255249
- name: List tests
256-
env:
257-
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
258250
# "check" is needed to activate all tests for listing purposes
259251
# listTestsInPartition writes test tasks that apply to the given partition to a file named
260252
# "test-tasks.txt" and then disables all tasks (including tests) after it runs
@@ -269,8 +261,6 @@ jobs:
269261
echo "test-tasks=$(cat test-tasks.txt | xargs echo | sed 's/\n/ /g')" >> $GITHUB_ENV
270262
271263
- name: Test
272-
env:
273-
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
274264
# spotless is checked separately since it's a common source of failure
275265
run: >
276266
./gradlew
@@ -280,6 +270,7 @@ jobs:
280270
-Porg.gradle.java.installations.paths=${{ steps.setup-test-java.outputs.path }}
281271
-Porg.gradle.java.installations.auto-download=false
282272
${{ inputs.no-build-cache && ' --no-build-cache' || '' }}
273+
${{ inputs.max-test-retries && format(' -PmaxTestRetries={0}', inputs.max-test-retries) || '' }}
283274
284275
- name: Build scan
285276
if: ${{ !cancelled() && hashFiles('build-scan.txt') != '' }}
@@ -352,14 +343,10 @@ jobs:
352343
gradle-home-cache-excludes: caches/build-cache-1
353344

354345
- name: Build
355-
env:
356-
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
357346
# running suite "none" compiles everything needed by smoke tests without executing any tests
358347
run: ./gradlew :smoke-tests:test -PsmokeTestSuite=none --no-daemon ${{ inputs.no-build-cache && ' --no-build-cache' || '' }}
359348

360349
- name: Test
361-
env:
362-
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
363350
run: ./gradlew :smoke-tests:test -PsmokeTestSuite=${{ matrix.smoke-test-suite }}${{ inputs.no-build-cache && ' --no-build-cache' || '' }}
364351

365352
- name: Upload jvm crash dump files if any

.github/workflows/build-daily-no-build-cache.yml

+8-4
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,20 @@ jobs:
1010
common:
1111
uses: ./.github/workflows/build-common.yml
1212
with:
13+
max-test-retries: 0
1314
no-build-cache: true
14-
secrets:
15-
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
1615

1716
test-latest-deps:
1817
uses: ./.github/workflows/reusable-test-latest-deps.yml
1918
with:
19+
max-test-retries: 0
20+
no-build-cache: true
21+
22+
test-indy:
23+
uses: ./.github/workflows/reusable-test-indy.yml
24+
with:
25+
max-test-retries: 0
2026
no-build-cache: true
21-
secrets:
22-
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
2327

2428
# muzzle is not included here because it doesn't use gradle cache anyway and so is already covered
2529
# by the normal daily build

.github/workflows/build-daily.yml

+9-4
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,18 @@ on:
99
jobs:
1010
common:
1111
uses: ./.github/workflows/build-common.yml
12-
secrets:
13-
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
12+
with:
13+
max-test-retries: 0
1414

1515
test-latest-deps:
1616
uses: ./.github/workflows/reusable-test-latest-deps.yml
17-
secrets:
18-
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
17+
with:
18+
max-test-retries: 0
19+
20+
test-indy:
21+
uses: ./.github/workflows/reusable-test-indy.yml
22+
with:
23+
max-test-retries: 0
1924

2025
muzzle:
2126
uses: ./.github/workflows/reusable-muzzle.yml

.github/workflows/build.yml

-6
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,13 @@ on:
1010
jobs:
1111
common:
1212
uses: ./.github/workflows/build-common.yml
13-
secrets:
14-
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
1513

1614
test-latest-deps:
1715
# release branches are excluded
1816
# because any time a new library version is released to maven central it can fail
1917
# which requires unnecessary release branch maintenance, especially for patches
2018
if: "!startsWith(github.ref_name, 'release/')"
2119
uses: ./.github/workflows/reusable-test-latest-deps.yml
22-
secrets:
23-
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
2420

2521
muzzle:
2622
# release branches are excluded
@@ -80,7 +76,6 @@ jobs:
8076

8177
- name: Build and publish artifact snapshots
8278
env:
83-
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
8479
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
8580
SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }}
8681
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
@@ -89,7 +84,6 @@ jobs:
8984

9085
- name: Build and publish gradle plugin snapshots
9186
env:
92-
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
9387
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
9488
SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }}
9589
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}

.github/workflows/reusable-test-indy.yml

+3-6
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ on:
99
no-build-cache:
1010
type: boolean
1111
required: false
12-
secrets:
13-
GRADLE_ENTERPRISE_ACCESS_KEY:
12+
max-test-retries:
13+
type: string
1414
required: false
1515

1616
permissions:
@@ -65,8 +65,6 @@ jobs:
6565
gradle-home-cache-excludes: caches/build-cache-1
6666

6767
- name: List tests
68-
env:
69-
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
7068
run: >
7169
./gradlew
7270
check -x spotlessCheck
@@ -78,13 +76,12 @@ jobs:
7876
echo "test-tasks=$(cat test-tasks.txt | xargs echo | sed 's/\n/ /g')" >> $GITHUB_ENV
7977
8078
- name: Test
81-
env:
82-
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
8379
run: >
8480
./gradlew
8581
${{ env.test-tasks }}
8682
-PtestIndy=true
8783
${{ inputs.no-build-cache && ' --no-build-cache' || '' }}
84+
${{ inputs.max-test-retries && format(' -PmaxTestRetries={0}', inputs.max-test-retries) || '' }}
8885
8986
- name: Build scan
9087
if: ${{ !cancelled() && hashFiles('build-scan.txt') != '' }}

.github/workflows/reusable-test-latest-deps.yml

+3-6
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ on:
99
no-build-cache:
1010
type: boolean
1111
required: false
12-
secrets:
13-
GRADLE_ENTERPRISE_ACCESS_KEY:
12+
max-test-retries:
13+
type: string
1414
required: false
1515

1616
permissions:
@@ -62,8 +62,6 @@ jobs:
6262
gradle-home-cache-excludes: caches/build-cache-1
6363

6464
- name: List tests
65-
env:
66-
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
6765
run: >
6866
./gradlew
6967
check -x spotlessCheck
@@ -76,13 +74,12 @@ jobs:
7674
echo "test-tasks=$(cat test-tasks.txt | xargs echo | sed 's/\n/ /g')" >> $GITHUB_ENV
7775
7876
- name: Test
79-
env:
80-
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
8177
run: >
8278
./gradlew
8379
${{ env.test-tasks }}
8480
-PtestLatestDeps=true
8581
${{ inputs.no-build-cache && ' --no-build-cache' || '' }}
82+
${{ inputs.max-test-retries && format(' -PmaxTestRetries={0}', inputs.max-test-retries) || '' }}
8683
8784
- name: Build scan
8885
if: ${{ !cancelled() && hashFiles('build-scan.txt') != '' }}

conventions/src/main/kotlin/otel.java-conventions.gradle.kts

+4-3
Original file line numberDiff line numberDiff line change
@@ -366,11 +366,12 @@ tasks.withType<Test>().configureEach {
366366
// This value is quite big because with lower values (3 mins) we were experiencing large number of false positives
367367
timeout.set(Duration.ofMinutes(15))
368368

369+
val defaultMaxRetries = if (System.getenv().containsKey("CI")) 5 else 0
370+
val maxTestRetries = gradle.startParameter.projectProperties["maxTestRetries"]?.toInt() ?: defaultMaxRetries
371+
369372
develocity.testRetry {
370373
// You can see tests that were retried by this mechanism in the collected test reports and build scans.
371-
if (System.getenv().containsKey("CI") || rootProject.hasProperty("retryTests")) {
372-
maxRetries.set(5)
373-
}
374+
maxRetries.set(maxTestRetries);
374375
}
375376

376377
reports {

settings.gradle.kts

+6-59
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ pluginManagement {
1313
}
1414

1515
plugins {
16-
id("com.gradle.develocity") version "3.18.2"
1716
id("com.gradle.common-custom-user-data-gradle-plugin") version "2.0.2"
1817
id("org.gradle.toolchains.foojay-resolver-convention") version "0.9.0"
1918
// this can't live in pluginManagement currently due to
@@ -22,6 +21,7 @@ plugins {
2221
// ./gradlew :smoke-tests:images:servlet:buildLinuxTestImages pushMatrix -PsmokeTestServer=jetty
2322
// ./gradlew :smoke-tests:images:servlet:buildWindowsTestImages pushMatrix -PsmokeTestServer=jetty
2423
id("com.bmuschko.docker-remote-api") version "9.4.0" apply false
24+
id("com.gradle.develocity") version "3.18.2"
2525
}
2626

2727
dependencyResolutionManagement {
@@ -48,64 +48,11 @@ dependencyResolutionManagement {
4848
}
4949
}
5050

51-
val gradleEnterpriseServer = "https://ge.opentelemetry.io"
52-
val isCI = System.getenv("CI") != null
53-
val geAccessKey = System.getenv("GRADLE_ENTERPRISE_ACCESS_KEY") ?: ""
54-
55-
// if GE access key is not given and we are in CI, then we publish to scans.gradle.com
56-
val useScansGradleCom = isCI && geAccessKey.isEmpty()
57-
58-
if (useScansGradleCom) {
59-
develocity {
60-
buildScan {
61-
termsOfUseUrl = "https://gradle.com/help/legal-terms-of-use"
62-
termsOfUseAgree = "yes"
63-
uploadInBackground = !isCI
64-
65-
capture {
66-
fileFingerprints = true
67-
}
68-
69-
if (!gradle.startParameter.taskNames.contains("listTestsInPartition")) {
70-
buildScanPublished {
71-
File("build-scan.txt").printWriter().use { writer ->
72-
writer.println(buildScanUri)
73-
}
74-
}
75-
}
76-
}
77-
}
78-
} else {
79-
develocity {
80-
server = gradleEnterpriseServer
81-
buildScan {
82-
uploadInBackground = !isCI
83-
publishing.onlyIf { it.isAuthenticated }
84-
85-
capture {
86-
fileFingerprints = true
87-
}
88-
89-
gradle.startParameter.projectProperties["testJavaVersion"]?.let { tag(it) }
90-
gradle.startParameter.projectProperties["testJavaVM"]?.let { tag(it) }
91-
gradle.startParameter.projectProperties["smokeTestSuite"]?.let {
92-
value("Smoke test suite", it)
93-
}
94-
95-
if (!gradle.startParameter.taskNames.contains("listTestsInPartition")) {
96-
buildScanPublished {
97-
File("build-scan.txt").printWriter().use { writer ->
98-
writer.println(buildScanUri)
99-
}
100-
}
101-
}
102-
}
103-
}
104-
105-
buildCache {
106-
remote(develocity.buildCache) {
107-
isPush = isCI && geAccessKey.isNotEmpty()
108-
}
51+
develocity {
52+
buildScan {
53+
publishing.onlyIf { System.getenv("CI") != null }
54+
termsOfUseUrl.set("https://gradle.com/help/legal-terms-of-use")
55+
termsOfUseAgree.set("yes")
10956
}
11057
}
11158

0 commit comments

Comments
 (0)