Commit 52c89ee
fix(build): pinned-version fallback for aichat + cosign release lookups
The previous build hit two transient warnings:
[WARN] 37-aichat.sh (0s) exit=1
[WARN] 42-cosign-policy.sh (0s) exit=1
Both scripts hit api.github.com unauthenticated for "latest release"
lookups. The unauthenticated rate limit is 60 req/hour per IP, and the
Forgejo Runner sometimes hits that ceiling on back-to-back rebuilds
(both scripts query simultaneously, doubling the burn rate). When the
limit fires, api.github.com returns HTTP 403 with a JSON message that
contains no "tag_name" field, the grep -Po pulls empty, and the
existing `[[ -n "$TAG" ]] || die` clause kills the layer.
Behaviour change:
1. Hit api.github.com (scurl auto-attaches Authorization when
GH_TOKEN/GITHUB_TOKEN/GHCR_TOKEN is in env -- preferred path).
2. If the lookup returns empty (rate-limit, network blip, JSON
parse miss) AND a *_FALLBACK_TAG/_VERSION is set, fall back to
the pinned version and emit a WARN line so the build log makes
the choice visible.
3. If both API and fallback are empty, die (intentional: never
ship a mystery binary). Bumping the fallback is a one-line edit.
Pinned fallbacks (current latest at time of write):
AICHAT_FALLBACK_TAG = v0.27.0
AICHAT_NG_FALLBACK_TAG = v0.31.0
COSIGN_FALLBACK_VERSION = v2.6.4 (still on v2.x per OCI 1.1 note)
The next build pass will either resolve the latest tag from
api.github.com (when the rate-limit window resets or when GH_TOKEN is
plumbed into the runner env) or fall back gracefully -- no more
spurious WARN entries on transient rate-limits.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent 444a5b9 commit 52c89ee
2 files changed
Lines changed: 36 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
24 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
25 | 37 | | |
26 | 38 | | |
27 | 39 | | |
28 | | - | |
29 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
30 | 50 | | |
31 | 51 | | |
32 | 52 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
22 | 28 | | |
23 | 29 | | |
24 | 30 | | |
25 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
26 | 36 | | |
27 | 37 | | |
28 | 38 | | |
| |||
0 commit comments