Skip to content

Fix Test workflow failing with an empty Python matrix - #43

Merged
saudzahirr merged 1 commit into
masterfrom
fix/empty-python-matrix
Aug 5, 2026
Merged

Fix Test workflow failing with an empty Python matrix#43
saudzahirr merged 1 commit into
masterfrom
fix/empty-python-matrix

Conversation

@saudzahirr

Copy link
Copy Markdown
Collaborator

The Test workflow has been failing with no failing step — only
fetch-python-versions ran, it reported success, and build-and-test
was never created.

Cause

The version fetch is a pipeline:

versions=$(curl -fsSL https://endoflife.date/... | jq "[...]")

Without pipefail, a pipeline reports the last command's exit status,
so curl failing is invisible: jq reads empty input, emits [], and the
matrix expands to zero jobs. GitHub then fails the run with nothing to
attribute it to. The log of run 30890495192 confirms it:

curl: (28) Failed to connect to endoflife.date port 443 after 270172 ms

So this was a transient network blip silently converted into a broken matrix
— not a code or toolchain problem.

Fix

  • set -euo pipefail so the step fails at the real cause
  • --retry 3 --retry-all-errors --connect-timeout 15 to ride out blips
  • an explicit empty-list check, so a zero-length matrix can never be emitted

Verified under bash -e <file> (exactly how Actions invokes run:): the old
form exits 0 with an empty value, the new form exits 1.

Note: every repo in the org shares this block and is vulnerable to the same
silent failure. Happy to follow up across the rest.

🤖 Generated with Claude Code

Run 30890495192 failed with no failing step: only fetch-python-versions
appeared, it reported success, and build-and-test was never created.

The cause is a masked network error. The version fetch is a pipeline:

    versions=$(curl -fsSL ... | jq '[...]')

Without pipefail a pipeline's exit status is the *last* command's, so
curl's failure is invisible - jq reads empty input, emits [], and the
matrix expands to zero jobs. The run then fails with nothing to point at.
The log confirms it:

    curl: (28) Failed to connect to endoflife.date port 443 after 270172 ms

Add `set -euo pipefail` so the step fails at the real cause, retry the
request, and reject an empty version list explicitly rather than emitting
a matrix that cannot produce jobs.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Aug 5, 2026

Copy link
Copy Markdown

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@saudzahirr
saudzahirr merged commit 4e2d16c into master Aug 5, 2026
23 checks passed
@saudzahirr
saudzahirr deleted the fix/empty-python-matrix branch August 5, 2026 05:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants