Skip to content

Commit 54da873

Browse files
authored
Put activePartitioning in ci-jobs plugin (#9912)
* Put activePartitioning in ci-jobs * Empty commit to re-run CI benchmarks
1 parent 434b694 commit 54da873

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

buildSrc/src/main/kotlin/datadog.ci-jobs.gradle.kts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66

77
import datadog.gradle.plugin.ci.findAffectedTaskPath
8+
import org.gradle.api.tasks.testing.Test
89
import java.io.File
910
import kotlin.math.abs
1011

@@ -20,6 +21,15 @@ allprojects {
2021
val currentTaskPartition = abs(project.path.hashCode() % taskPartitionCount.toInt())
2122
extra.set("activePartition", currentTaskPartition == taskPartition.toInt())
2223
}
24+
25+
// Disable test tasks if not in active partition
26+
val activePartitionProvider = providers.provider {
27+
project.extra.properties["activePartition"] as? Boolean ?: true
28+
}
29+
30+
tasks.withType<Test>().configureEach {
31+
enabled = activePartitionProvider.get()
32+
}
2333
}
2434

2535
fun relativeToGitRoot(f: File): File {

buildSrc/src/main/kotlin/datadog.configure-tests.gradle.kts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,9 @@ val skipTestsProvider = rootProject.providers.gradleProperty("skipTests")
3232
val skipForkedTestsProvider = rootProject.providers.gradleProperty("skipForkedTests")
3333
val skipFlakyTestsProvider = rootProject.providers.gradleProperty("skipFlakyTests")
3434
val runFlakyTestsProvider = rootProject.providers.gradleProperty("runFlakyTests")
35-
val activePartitionProvider = providers.provider {
36-
project.extra.properties["activePartition"] as? Boolean ?: true
37-
}
3835

3936
// Go through the Test tasks and configure them
4037
tasks.withType<Test>().configureEach {
41-
enabled = activePartitionProvider.get()
42-
4338
// Disable all tests if skipTests property was specified
4439
onlyIf("skipTests are undefined or false") { !skipTestsProvider.isPresent }
4540

0 commit comments

Comments
 (0)