Skip to content

fix(ci): prevent matrix-generation steps from masking gradle failures#11840

Open
kiview wants to merge 1 commit into
mainfrom
fix/ci-matrix-pipefail
Open

fix(ci): prevent matrix-generation steps from masking gradle failures#11840
kiview wants to merge 1 commit into
mainfrom
fix/ci-matrix-pipefail

Conversation

@kiview

@kiview kiview commented Jun 11, 2026

Copy link
Copy Markdown
Member

Problem

The dynamic-matrix steps in .github/workflows/ci.yml (find_gradle_jobs, find_examples_jobs, find_docs_examples_jobs) captured ./gradlew testMatrix output inside a command substitution — in two of them piped into jq:

TASKS=$(./gradlew --no-daemon --parallel -q testMatrix | jq '...' --compact-output)
echo "matrix={\"gradle_args\":$TASKS}" >> $GITHUB_OUTPUT

In a shell pipeline A | B, the exit status is that of the last command. GitHub Actions run: blocks run bash with set -e by default, but not pipefail. So when ./gradlew testMatrix fails (e.g. a module no longer compiles), the failure is swallowed: jq exits 0 on empty input, the step reports success, and an empty/invalid matrix is emitted. (The non-piped job had the same class of bug: a failing command inside a $(...) assignment does not trip set -e either.)

An empty matrix means GitHub spawns zero check jobs. Because the downstream jobs are chained via needs::

check -> find_examples_jobs -> check_examples -> find_docs_examples_jobs -> check_docs_examples

they all get skipped, including the required check_docs_examples (:docs:examples:check) context. The net effect is a falsely-green build that ran no module checks at all.

This was discovered while combining Dependabot PRs: a cassandra-driver-core 4.0.0 bump broke compilation, yet individual CI still went green.

Fix

Add set -o pipefail and run gradle on its own line, redirecting its output to a file before handing it to jq. Gradle's non-zero exit status is now caught directly by the default set -e, before any matrix output is written — so a non-compiling module fails the matrix-generation job loudly instead of cascading silent skips.

🤖 Generated with Claude Code

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>
@kiview kiview requested a review from a team as a code owner June 11, 2026 10:08
@github-actions github-actions Bot added the github_actions Pull requests that update Github_actions code label Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

github_actions Pull requests that update Github_actions code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant