fix(ci): prevent matrix-generation steps from masking gradle failures#11840
Open
kiview wants to merge 1 commit into
Open
fix(ci): prevent matrix-generation steps from masking gradle failures#11840kiview wants to merge 1 commit into
kiview wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The dynamic-matrix steps in
.github/workflows/ci.yml(find_gradle_jobs,find_examples_jobs,find_docs_examples_jobs) captured./gradlew testMatrixoutput inside a command substitution — in two of them piped intojq:In a shell pipeline
A | B, the exit status is that of the last command. GitHub Actionsrun:blocks run bash withset -eby default, but notpipefail. So when./gradlew testMatrixfails (e.g. a module no longer compiles), the failure is swallowed:jqexits0on 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 tripset -eeither.)An empty matrix means GitHub spawns zero
checkjobs. Because the downstream jobs are chained vianeeds::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-core4.0.0 bump broke compilation, yet individual CI still went green.Fix
Add
set -o pipefailand run gradle on its own line, redirecting its output to a file before handing it tojq. Gradle's non-zero exit status is now caught directly by the defaultset -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