Commit bc11bbf
authored
Skip rebuilds when Docker Hub tag check is inconclusive (#357)
## Summary
The scheduled workflow's image-existence check silently defaults to
"rebuild" whenever the Docker Hub tags API returns anything other than a
parseable `{results: [...]}` body. Rate limits, 5xx, connection resets,
and non-JSON edge responses all collapse to the same "tag missing"
signal, so successful builds get re-queued an hour later even when the
upstream source hasn't moved.
Concrete example that triggered this PR: run
[24721350367](https://github.com/ethpandaops/eth-client-docker-image-builder/actions/runs/24721350367)
queued a full rebuild of `ethpandaops/nimbus-eth2:epbs-devnet-1-a23ebfd`
and its `-minimal` variant even though:
- `status-im/nimbus-eth2#epbs-devnet-1` HEAD hadn't moved in a week
(`a23ebfd`, committed 2026-04-14).
- Both tags were already on Docker Hub from a prior run the same day
(pushed 10:47 UTC).
## What changed
`.github/workflows/scheduled.yml` → `process_image()`:
- Captures HTTP status separately from body via `curl -w
'\n%{http_code}' --max-time 20`.
- Classifies the response:
- `200` with a well-formed `.results` array → authoritative, compute
`exists` from an **exact** `.name == $tag` match (was a substring match,
which could have masked a missing tag with a prefix-matching sibling).
- `404` with `{"message":"object not found"}` → repo doesn't exist yet
on Hub → build (first push).
- Anything else (non-JSON, 429, 5xx, timeout, empty body) → retry up to
3 times with 2/4/6s backoff.
- On persistent failure emits `exists:"unknown"` and logs a WARN,
instead of silently falling back to "rebuild".
Build-decision loop:
- Only queues a build when `images[$IMAGE] == "false"` (authoritative
empty).
- `"unknown"` and missing entries log a skip line and are passed over.
## Verification
Ran the new `process_image()` against the live Docker Hub API for six
scenarios:
| Case | Expected | Got |
|---|---|---|
| Exact tag present | `true` | `true` |
| Tag genuinely absent (200, empty results) | `false` | `false` |
| Repo missing on Hub (404 object not found) | `false` | `false` |
| Unreachable host | `unknown` after 3 retries | `unknown` |
| Non-JSON 4xx body | `unknown` after 3 retries | `unknown` |
| Substring-only match (would have fooled old logic) | `false` | `false`
|
Also re-ran the full check path for
`status-im/nimbus-eth2#epbs-devnet-1` and the `-minimal` variant against
the live API — both now correctly resolve to `exists:"true"` → skip
build, matching reality.
`bash -n` on the extracted embedded script passes.
## Test plan
- [ ] Next scheduled run completes without queuing nimbus-eth2
`epbs-devnet-1` (or any other already-present tag).
- [ ] If Docker Hub returns transient errors during a future run, log
shows `Skipping …: Docker Hub existence check was inconclusive.` instead
of a queued rebuild.
- [ ] First build for a brand-new client (Docker Hub repo not yet
created) still triggers correctly via the 404 path.
Signed-off-by: Barnabas Busa <busa.barnabas@gmail.com>1 parent ad0e985 commit bc11bbf
1 file changed
Lines changed: 51 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| 87 | + | |
87 | 88 | | |
88 | 89 | | |
89 | 90 | | |
90 | | - | |
91 | 91 | | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
97 | 133 | | |
98 | 134 | | |
99 | | - | |
| 135 | + | |
100 | 136 | | |
101 | 137 | | |
102 | 138 | | |
| |||
126 | 162 | | |
127 | 163 | | |
128 | 164 | | |
129 | | - | |
| 165 | + | |
130 | 166 | | |
131 | 167 | | |
132 | 168 | | |
| |||
154 | 190 | | |
155 | 191 | | |
156 | 192 | | |
157 | | - | |
158 | | - | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
159 | 200 | | |
160 | 201 | | |
161 | 202 | | |
| |||
0 commit comments