registry

package
v0.30.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 21, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fetch

func Fetch(ctx context.Context, ref string, opts *Options) (v1.Image, error)

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

func FetchConfig(ctx context.Context, ref string, opts *Options) ([]byte, error)

FetchConfig returns the config JSON for ref. Multi-arch indices are resolved via the caller's platform (set on Options).

func FetchDescriptor

func FetchDescriptor(ctx context.Context, ref string, opts *Options) (*remote.Descriptor, error)

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

func FetchDigest(ctx context.Context, ref string, opts *Options) (string, error)

FetchDigest returns "sha256:<hex>" for ref's manifest as served.

func FetchManifest

func FetchManifest(ctx context.Context, ref string, opts *Options) ([]byte, error)

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.

func ListTags

func ListTags(ctx context.Context, repoRef string, opts *Options, visit func(tags []string) error) error

ListTags invokes visit for every tag page of repo. Stopping early: return a non-nil error (context.Canceled is reasonable for user abort).

func Push

func Push(ctx context.Context, ref string, obj partial.WithRawManifest, opts *Options) (v1.Hash, error)

Push writes obj (v1.Image or v1.ImageIndex) under ref and returns the resulting digest. Anything else is a programmer error.

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

func (o *Options) WithContext(ctx context.Context) *Options

WithContext replaces the ambient context.

func (*Options) WithInsecure

func (o *Options) WithInsecure() *Options

WithInsecure tolerates non-TLS references during name parsing. The HTTP transport itself is configured separately via WithTransport.

func (*Options) WithKeychain

func (o *Options) WithKeychain(kc authn.Keychain) *Options

WithKeychain replaces the keychain that authenticates registry calls. Last call wins.

func (*Options) WithNondistributable

func (o *Options) WithNondistributable() *Options

WithNondistributable allows pushing foreign (non-distributable) layers.

func (*Options) WithPlatform

func (o *Options) WithPlatform(p *v1.Platform) *Options

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).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL