Skip to content

Commit 0ff8b97

Browse files
committed
Only disable test retries on daily builds
1 parent c37b210 commit 0ff8b97

File tree

6 files changed

+37
-0
lines changed

6 files changed

+37
-0
lines changed

.github/workflows/build-common.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99
no-build-cache:
1010
type: boolean
1111
required: false
12+
max-test-retries:
13+
type: int
14+
required: false
1215
skip-openj9-tests:
1316
type: boolean
1417
required: false
@@ -267,6 +270,7 @@ jobs:
267270
-Porg.gradle.java.installations.paths=${{ steps.setup-test-java.outputs.path }}
268271
-Porg.gradle.java.installations.auto-download=false
269272
${{ inputs.no-build-cache && ' --no-build-cache' || '' }}
273+
${{ inputs.max-test-retries && ' -PmaxTestRetries=' + inputs.max-test-retries || '' }}
270274
271275
- name: Build scan
272276
if: ${{ !cancelled() && hashFiles('build-scan.txt') != '' }}

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,19 @@ jobs:
1010
common:
1111
uses: ./.github/workflows/build-common.yml
1212
with:
13+
max-test-retries: 0
1314
no-build-cache: true
1415

1516
test-latest-deps:
1617
uses: ./.github/workflows/reusable-test-latest-deps.yml
1718
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
1826
no-build-cache: true
1927

2028
# muzzle is not included here because it doesn't use gradle cache anyway and so is already covered

.github/workflows/build-daily.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,18 @@ on:
99
jobs:
1010
common:
1111
uses: ./.github/workflows/build-common.yml
12+
with:
13+
max-test-retries: 0
1214

1315
test-latest-deps:
1416
uses: ./.github/workflows/reusable-test-latest-deps.yml
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
1524

1625
muzzle:
1726
uses: ./.github/workflows/reusable-muzzle.yml

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99
no-build-cache:
1010
type: boolean
1111
required: false
12+
max-test-retries:
13+
type: int
14+
required: false
1215

1316
permissions:
1417
contents: read
@@ -78,6 +81,7 @@ jobs:
7881
${{ env.test-tasks }}
7982
-PtestIndy=true
8083
${{ inputs.no-build-cache && ' --no-build-cache' || '' }}
84+
${{ inputs.max-test-retries && ' -PmaxTestRetries=' + inputs.max-test-retries || '' }}
8185
8286
- name: Build scan
8387
if: ${{ !cancelled() && hashFiles('build-scan.txt') != '' }}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99
no-build-cache:
1010
type: boolean
1111
required: false
12+
max-test-retries:
13+
type: int
14+
required: false
1215

1316
permissions:
1417
contents: read
@@ -76,6 +79,7 @@ jobs:
7679
${{ env.test-tasks }}
7780
-PtestLatestDeps=true
7881
${{ inputs.no-build-cache && ' --no-build-cache' || '' }}
82+
${{ inputs.max-test-retries && ' -PmaxTestRetries=' + inputs.max-test-retries || '' }}
7983
8084
- name: Build scan
8185
if: ${{ !cancelled() && hashFiles('build-scan.txt') != '' }}

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,14 @@ 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+
372+
develocity.testRetry {
373+
// You can see tests that were retried by this mechanism in the collected test reports and build scans.
374+
maxRetries.set(maxTestRetries);
375+
}
376+
369377
reports {
370378
junitXml.isOutputPerTestCase = true
371379
}

0 commit comments

Comments
 (0)