Documentation
¶
Overview ¶
Package registrypush pushes images from hypeman's OCI cache to remote container registries.
Credentials are resolved by Provider implementations keyed on the target reference. The push itself is registry-agnostic; registries with custom auth flows plug in as additional providers without touching the push path.
Index ¶
Constants ¶
This section is empty.
Variables ¶
ErrUnauthorized means the destination registry rejected the push credentials. On pull a 401 is treated as "image not visible"; on push it is a caller-fixable credential problem and must surface as such.
Functions ¶
This section is empty.
Types ¶
type KeychainProvider ¶
KeychainProvider resolves credentials from a Docker-style keychain. A nil Keychain uses authn.DefaultKeychain, which reads ~/.docker/config.json including any configured credential helpers.
func (*KeychainProvider) Authenticator ¶
func (p *KeychainProvider) Authenticator(ctx context.Context, ref name.Reference) (authn.Authenticator, error)
Authenticator resolves credentials for the target registry from the keychain. The caller's context is forwarded so context-aware keychains (authn.ContextKeychain) receive cancellation and deadlines.
type Multi ¶
Multi routes credential resolution by registry host. The provider whose key matches the target's registry host wins; everything else falls back to Default. Keys must match the canonical host form reported by name.Registry.RegistryStr (e.g. "index.docker.io" for Docker Hub). A nil Default resolves anonymously.
func (*Multi) Authenticator ¶
Authenticator dispatches to the provider registered for the target host.
type Options ¶
type Options struct {
// Insecure allows pushing to plain-HTTP registries. Localhost registries
// are always treated as http by go-containerregistry regardless of this
// flag.
Insecure bool
}
Options configures a push.
type Provider ¶
type Provider interface {
Authenticator(ctx context.Context, ref name.Reference) (authn.Authenticator, error)
}
Provider resolves credentials for pushing to a target reference.
type Result ¶
type Result struct {
// Reference is the target reference the image was pushed to.
Reference string
// Digest is the pushed manifest digest.
Digest string
// Layers is the number of layers in the pushed image.
Layers int
// Bytes is the total compressed size of the pushed layers.
Bytes int64
}
Result describes a completed push.
func Push ¶
func Push(ctx context.Context, img v1.Image, target string, provider Provider, opts Options) (*Result, error)
Push writes img to the target reference using credentials from provider. A nil provider pushes anonymously. Pushed blobs are identical to the source image. For OCI images the manifest digest is preserved end to end; for Docker v2 inputs the manifest is converted to OCI on push, so the pushed digest is the converted digest (see Result.Digest). Registry errors are classified with classifyPushError so callers can distinguish authentication failures, rate limits, and missing repositories from transport failures.
func PushFromCache ¶
func PushFromCache(ctx context.Context, p *paths.Paths, digest, target string, provider Provider, opts Options) (*Result, error)
PushFromCache pushes the image stored in the local OCI cache under the given manifest digest. Returns ocicache.ErrNotFound if the digest is not in the cache (source phase) or images.ErrNotFound if the destination registry reports the repository or manifest as missing (target phase).
type StaticProvider ¶
type StaticProvider struct {
Config authn.AuthConfig
}
StaticProvider always returns the same fixed credentials, regardless of target. Useful for a single pre-configured destination.
func (*StaticProvider) Authenticator ¶
func (p *StaticProvider) Authenticator(_ context.Context, _ name.Reference) (authn.Authenticator, error)
Authenticator returns the configured credentials.