Skip to content

Commit 474b8a0

Browse files
committed
chore: Handle no value when gitlab job is not in a matrix
1 parent de594c4 commit 474b8a0

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

buildSrc/src/main/kotlin/datadog/gradle/plugin/ci/CIJobsExtensions.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,13 @@ val Project.isInSelectedSlot: Provider<Boolean>
2222
return@map true
2323
}
2424

25-
val selectedSlot = parts[0].toInt()
26-
val totalSlots = parts[1].toInt()
25+
val selectedSlot = parts[0].toIntOrNull()
26+
val totalSlots = parts[1].toIntOrNull()
27+
28+
if (selectedSlot == null || totalSlots == null || totalSlots <= 0) {
29+
project.logger.warn("Invalid slot values '{}', expected numeric 'X/Y' with Y > 0. Treating all projects as selected.", slot)
30+
return@map true
31+
}
2732

2833
// Distribution numbers when running on rootProject.allprojects indicates
2934
// bucket sizes are reasonably balanced:

0 commit comments

Comments
 (0)