(ctx context.Context)
| 39 | const clientContextKey contextKey = "ec.oci.client" |
| 40 | |
| 41 | func CreateRemoteOptions(ctx context.Context) []remote.Option { |
| 42 | backoff := remote.Backoff{ |
| 43 | Duration: echttp.DefaultBackoff.Duration, |
| 44 | Factor: echttp.DefaultBackoff.Factor, |
| 45 | Jitter: echttp.DefaultBackoff.Jitter, |
| 46 | Steps: echttp.DefaultRetry.MaxRetry, |
| 47 | } |
| 48 | |
| 49 | // Log retry/backoff configuration when tracing is enabled |
| 50 | if log.IsLevelEnabled(log.TraceLevel) { |
| 51 | log.Tracef("OCI client retry configuration: max_retry=%d, max_wait=%v, base_duration=%v, factor=%.2f, jitter=%.2f", |
| 52 | echttp.DefaultRetry.MaxRetry, |
| 53 | echttp.DefaultRetry.MaxWait, |
| 54 | echttp.DefaultBackoff.Duration, |
| 55 | echttp.DefaultBackoff.Factor, |
| 56 | echttp.DefaultBackoff.Jitter, |
| 57 | ) |
| 58 | } |
| 59 | |
| 60 | // Create a transport that handles transient errors with exponential backoff |
| 61 | var transport http.RoundTripper |
| 62 | if log.IsLevelEnabled(log.TraceLevel) { |
| 63 | transport = echttp.NewTracingRoundTripper(echttp.NewRetryTransport(remote.DefaultTransport)) |
| 64 | } else { |
| 65 | transport = echttp.NewRetryTransport(remote.DefaultTransport) |
| 66 | } |
| 67 | |
| 68 | return []remote.Option{ |
| 69 | remote.WithTransport(transport), |
| 70 | remote.WithContext(ctx), |
| 71 | remote.WithAuthFromKeychain(authn.DefaultKeychain), |
| 72 | remote.WithRetryBackoff(backoff), |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | type Client interface { |
| 77 | VerifyImageSignatures(name.Reference, *cosign.CheckOpts) ([]oci.Signature, bool, error) |
no outgoing calls
no test coverage detected