Skip to content

Commit 177beb4

Browse files
kiviewclaude
andcommitted
fix(ci): prevent matrix-generation steps from masking gradle failures
The dynamic matrix steps (find_gradle_jobs, find_examples_jobs, find_docs_examples_jobs) captured `./gradlew testMatrix` output inside a command substitution, in two cases piped into jq. In a pipeline the step exit status is that of the last command (jq), so a gradle failure (e.g. a module that does not compile) was masked: jq exits 0 on empty input, the step reported success, and an empty/invalid matrix was emitted. An empty matrix means GitHub spawns zero `check` jobs, and since the downstream jobs are chained via `needs:` (check -> find_examples_jobs -> check_examples -> find_docs_examples_jobs -> check_docs_examples), they all get skipped. The net effect is a falsely-green build that ran no module checks at all. This recently let a breaking dependency bump (cassandra-driver-core 4.0.0) pass CI as green. Fix: add `set -o pipefail` and run gradle on its own line, redirecting output to a file before handing it to jq. Gradle's non-zero exit is now caught directly by the default `set -e`, before the matrix output is written. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 905a445 commit 177beb4

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ jobs:
9696
# we should not push empty results to the cache
9797
READ_ONLY_REMOTE_GRADLE_CACHE: true
9898
run: |
99-
TASKS=$(./gradlew --no-daemon --parallel -q testMatrix | jq 'del(.[] | select(. == ":testcontainers:check" or startswith(":docs:")))' --compact-output)
99+
set -o pipefail
100+
./gradlew --no-daemon --parallel -q testMatrix > matrix.json
101+
TASKS=$(jq 'del(.[] | select(. == ":testcontainers:check" or startswith(":docs:")))' --compact-output matrix.json)
100102
echo $TASKS
101103
echo "matrix={\"gradle_args\":$TASKS}" >> $GITHUB_OUTPUT
102104
check:
@@ -130,7 +132,9 @@ jobs:
130132
# we should not push empty results to the cache
131133
READ_ONLY_REMOTE_GRADLE_CACHE: true
132134
run: |
133-
TASKS=$(./gradlew --no-daemon --parallel -q testMatrix)
135+
set -o pipefail
136+
./gradlew --no-daemon --parallel -q testMatrix > matrix.json
137+
TASKS=$(cat matrix.json)
134138
echo $TASKS
135139
echo "matrix={\"gradle_args\":$TASKS}" >> $GITHUB_OUTPUT
136140
check_examples:
@@ -164,7 +168,9 @@ jobs:
164168
# we should not push empty results to the cache
165169
READ_ONLY_REMOTE_GRADLE_CACHE: true
166170
run: |
167-
TASKS=$(./gradlew --no-daemon --parallel -q testMatrix | jq 'map(select(startswith(":docs:")))' --compact-output)
171+
set -o pipefail
172+
./gradlew --no-daemon --parallel -q testMatrix > matrix.json
173+
TASKS=$(jq 'map(select(startswith(":docs:")))' --compact-output matrix.json)
168174
echo $TASKS
169175
echo "matrix={\"gradle_args\":$TASKS}" >> $GITHUB_OUTPUT
170176
check_docs_examples:

0 commit comments

Comments
 (0)