Documentation
¶
Overview ¶
Package registry is the thin domain layer of `d8 cr` on top of go-containerregistry/pkg/v1/*. It replaces the upstream pkg/crane facade - we own every entry point, error message and option default.
Index ¶
- func Fetch(ctx context.Context, ref string, opts *Options) (v1.Image, error)
- func FetchConfig(ctx context.Context, ref string, opts *Options) ([]byte, error)
- func FetchDescriptor(ctx context.Context, ref string, opts *Options) (*remote.Descriptor, error)
- func FetchDigest(ctx context.Context, ref string, opts *Options) (string, error)
- func FetchManifest(ctx context.Context, ref string, opts *Options) ([]byte, error)
- func InsecureTransport() http.RoundTripper
- func ListCatalog(ctx context.Context, regRef string, opts *Options, ...) error
- func ListTags(ctx context.Context, repoRef string, opts *Options, ...) error
- func Push(ctx context.Context, ref string, obj partial.WithRawManifest, opts *Options) (v1.Hash, error)
- type Options
- func (o *Options) WithContext(ctx context.Context) *Options
- func (o *Options) WithInsecure() *Options
- func (o *Options) WithKeychain(kc authn.Keychain) *Options
- func (o *Options) WithNondistributable() *Options
- func (o *Options) WithPlatform(p *v1.Platform) *Options
- func (o *Options) WithTransport(t http.RoundTripper) *Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Fetch ¶
Fetch resolves ref and returns a v1.Image. For multi-arch indices remote.Image picks the current runtime platform unless opts.Platform pins another one.
func FetchConfig ¶
FetchConfig returns the config JSON for ref. Multi-arch indices are resolved via the caller's platform (set on Options).
func FetchDescriptor ¶
FetchDescriptor returns the raw remote descriptor, leaving media-type dispatch to the caller (pull uses it to tell an index from an image).
func FetchDigest ¶
FetchDigest returns "sha256:<hex>" for ref's manifest as served.
func FetchManifest ¶
FetchManifest returns the raw manifest bytes as the registry served them. This preserves signatures and byte-for-byte JSON the user may want to pipe.
func InsecureTransport ¶
func InsecureTransport() http.RoundTripper
InsecureTransport returns a fresh http.Transport cloned from remote's default with TLS verification disabled. Use only when the user explicitly opts in via --insecure.
func ListCatalog ¶
func ListCatalog(ctx context.Context, regRef string, opts *Options, visit func(repos []string) error) error
ListCatalog invokes visit for every repository page on the given registry. Not every registry implements /v2/_catalog - the underlying call will surface a 404 through the error chain.
Types ¶
type Options ¶
type Options struct {
Remote []remote.Option
Name []name.Option
Platform *v1.Platform
Keychain authn.Keychain
Context context.Context
}
Options accumulates everything the domain layer needs to talk to a registry: auth, transport, platform hint, name-parsing flags. Each builder mutates the receiver and returns it so calls chain.
The two slices (Remote, Name) are what actually gets passed to go-containerregistry: Remote to remote.*, Name to name.ParseReference / name.NewRepository / name.NewRegistry / name.NewTag.
func New ¶
func New() *Options
New returns Options seeded with the default Docker keychain and a background context. Keychain / platform / context are NOT baked into o.Remote here - they are finalized lazily by remoteWithContext at fetch time so repeated builder calls (e.g. WithPlatform twice with different values) cannot stack duplicate options on the slice.
func (*Options) WithContext ¶
WithContext replaces the ambient context.
func (*Options) WithInsecure ¶
WithInsecure tolerates non-TLS references during name parsing. The HTTP transport itself is configured separately via WithTransport.
func (*Options) WithKeychain ¶
WithKeychain replaces the keychain that authenticates registry calls. Last call wins.
func (*Options) WithNondistributable ¶
WithNondistributable allows pushing foreign (non-distributable) layers.
func (*Options) WithPlatform ¶
WithPlatform pins a target platform for multi-arch indices. Nil is a no-op (so a flag-driven caller can pass the parsed result directly without branching). Last non-nil call wins.
func (*Options) WithTransport ¶
func (o *Options) WithTransport(t http.RoundTripper) *Options
WithTransport installs a custom HTTP transport (typically a clone of remote.DefaultTransport with TLS skip-verify toggled).