Documentation
¶
Overview ¶
Package oci wraps oras-go for agentfile use: authenticated remote repositories, manifest/index resolution, blob fetching, and a Puller abstraction that extracts a bin layer from an image.
Index ¶
- Constants
- func AgentFetcher(opts ...RemoteRepositoryOption) func(ctx context.Context, ref spec.Reference) (*spec.Agentfile, error)
- func FetchBlobBytes(ctx context.Context, fetcher content.Fetcher, desc v1.Descriptor) ([]byte, error)
- func NewRemoteRepository(ref spec.Reference, opts ...RemoteRepositoryOption) (*remote.Repository, error)
- func ParseTag(ref spec.Reference) string
- func ResolveManifest(ctx context.Context, fetcher content.Fetcher, desc v1.Descriptor) (*v1.Manifest, error)
- func WithPlainHTTP(repo *remote.Repository)
- type Puller
- type RemoteRepositoryOption
Constants ¶
const DefaultRetryMaxElapsedTime = 30 * time.Second
DefaultRetryMaxElapsedTime caps the total wall-clock time the retry transport will spend on a single HTTP request, including all backoff sleeps. 30 s comfortably covers the GHCR "first-push" 500 race (typically 1–5 s) without making bad-credential errors feel sluggish — the auth path 401s fast and 4xx isn't retried.
Variables ¶
This section is empty.
Functions ¶
func AgentFetcher ¶
func AgentFetcher( opts ...RemoteRepositoryOption, ) func(ctx context.Context, ref spec.Reference) (*spec.Agentfile, error)
AgentFetcher returns a resolve.Fetcher that pulls agent artifacts from OCI registries.
func FetchBlobBytes ¶
func FetchBlobBytes(ctx context.Context, fetcher content.Fetcher, desc v1.Descriptor) ([]byte, error)
FetchBlobBytes reads the blob identified by desc from fetcher into memory. Accepts any content.Fetcher so it can be exercised against in-memory stores in tests as well as remote repositories.
func NewRemoteRepository ¶
func NewRemoteRepository(ref spec.Reference, opts ...RemoteRepositoryOption) (*remote.Repository, error)
NewRemoteRepository constructs an oras remote.Repository bound to ref, wired up with Docker credential resolution and a retrying transport that tolerates transient 5xx + transport errors. The retry is what lets the first-ever push of a brand-new GHCR package succeed: GHCR provisions backend storage on the first manifest PUT and the request can race the provisioning step.
func ResolveManifest ¶
func ResolveManifest(ctx context.Context, fetcher content.Fetcher, desc v1.Descriptor) (*v1.Manifest, error)
ResolveManifest fetches the blob at desc and parses it as a v1.Manifest. If the blob is a v1.Index, a platform-appropriate child manifest is selected and resolved recursively.
func WithPlainHTTP ¶
func WithPlainHTTP(repo *remote.Repository)
WithPlainHTTP configures the repository to use HTTP instead of HTTPS. Suitable for local/dev registries only.
Types ¶
type Puller ¶
func NoopPuller ¶
func NoopPuller() Puller
func RemotePuller ¶
func RemotePuller(opts ...RemoteRepositoryOption) Puller
type RemoteRepositoryOption ¶
type RemoteRepositoryOption func(*remote.Repository)
RemoteRepositoryOption mutates a remote repository at construction time.