Commit b9de112
committed
fix(backend): short-circuit retry.Do on 401/403 auth errors from the registry
pull and push wrap per-layer processing in retry.Do with defaultRetryOpts,
which retries up to 6 times on exponential 5s..60s backoff. The options
didn't set a RetryIf predicate, so every error was treated as transient -
including 401 Unauthorized and 403 Forbidden from the registry. Auth
errors never recover on retry with the same credentials, so the user
sat through ~30-60s of silent backoff before seeing the real failure.
Add a predicate that unwraps the error chain looking for
oras.land/oras-go/v2/registry/remote/errcode.ErrorResponse (the
typed error oras emits for HTTP responses the registry rejected) and
returns false for 401/403. Transient HTTP failures (5xx, network
resets, registry rate-limit 429, etc.) still retry as before.
Fixes #494
Signed-off-by: SAY-5 <SAY-5@users.noreply.github.com>1 parent f5cd9a6 commit b9de112
1 file changed
Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
| 25 | + | |
23 | 26 | | |
24 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
25 | 41 | | |
26 | 42 | | |
27 | 43 | | |
28 | 44 | | |
29 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
30 | 49 | | |
0 commit comments