The manifest contains one failed check and one successful check. The CI command prints false, then true, and exits with status 0. Reverse the two entries and the exact same command fails. A release gate should give the same answer either way.
Reproduce the green build
Run both commands in a shell without errexit so you can inspect their statuses. These results were recorded with jq 1.7.
echo '[{"ok":false},{"ok":true}]' | jq -e '.[] | .ok' echo "status=$?" echo '[{"ok":true},{"ok":false}]' | jq -e '.[] | .ok' echo "status=$?" .[] | .ok emits one JSON value per check. On a successful run, jq's -e option uses the last output value to set the exit status. An earlier false stays in the log, but it doesn't make the command fail.
Give the shell one verdict
If the gate requires at least one check and every check must explicitly report true, write both conditions into the filter.
jq -e 'length > 0 and all(.[]; .ok == true)' checks.json checks.json must contain a single JSON array of objects. The comparison .ok == true rejects a missing value and the string "true". For this gate, those values mean that the producer didn't supply a passing result in the expected format.
Keep the length check: all returns true for an empty array. Without a length check, a build could pass before running a single check.
Prove the gate before using it in CI
Try both orderings, a passing file, and an empty manifest. A missing value is worth testing too. This loop sends one JSON document per run; it doesn't pipe a stream of documents into a single jq invocation.
for manifest in \ '[{"ok":false},{"ok":true}]' '[{"ok":true},{"ok":false}]' \ '[{"ok":true},{"ok":true}]' '[]' '[{}]' '[{"ok":"true"}]' do echo "$manifest" | jq -e 'length > 0 and all(.[]; .ok == true)' echo "status=$?" done The expected statuses are 1, 1, 0, 1, 1, 1. In a deployment script, use jq's status to decide whether to proceed; keep the per-check output in a separate diagnostic step.
If the input is newline-delimited JSON or can contain multiple top-level values, reduce the whole stream to one verdict first. For a file expected to contain exactly one manifest, jq -s lets you check the outer array has exactly one element before validating the manifest itself.








