Documentation
¶
Index ¶
- func IsDockerHubAddress(addr string) bool
- type Registry
- type RemoteRegistry
- func (r *RemoteRegistry) Address() string
- func (r *RemoteRegistry) IsLocal() bool
- func (r *RemoteRegistry) Push(_ context.Context, imageName, tag, ociTarPath string) error
- func (r *RemoteRegistry) Start(_ context.Context) error
- func (r *RemoteRegistry) Stop(_ context.Context) error
- func (r *RemoteRegistry) UseDockerMediaTypes() bool
- type ZotRegistry
- func (z *ZotRegistry) Address() string
- func (z *ZotRegistry) IsLocal() bool
- func (z *ZotRegistry) Push(_ context.Context, imageName, tag, ociTarPath string) error
- func (z *ZotRegistry) Start(ctx context.Context) error
- func (z *ZotRegistry) Stop(_ context.Context) error
- func (z *ZotRegistry) UseDockerMediaTypes() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsDockerHubAddress ¶ added in v0.10.0
IsDockerHubAddress reports whether addr targets Docker Hub. Accepts the three canonical spellings (docker.io, index.docker.io, registry-1.docker.io) with or without a trailing repository path. Docker Hub's frontend rejects PUTs of pure OCI image indexes with an HTML 400; callers use this to decide whether to emit Docker-scheme media types instead.
Types ¶
type Registry ¶
type Registry interface {
Start(ctx context.Context) error
Stop(ctx context.Context) error
Address() string
Push(ctx context.Context, imageName, tag, ociTarPath string) error
IsLocal() bool
UseDockerMediaTypes() bool
}
Registry manages an OCI registry for staging local base images.
func NewRegistry ¶
func NewRegistry(dataDir string, registryConfig *model.RegistryConfig) (Registry, error)
NewRegistry creates a Registry based on the environment. In CI (CI env var set), it returns a remote registry passthrough. The registry address is resolved with the following precedence:
- CONTAINER_HIVE_REGISTRY env var
- registry.address from hive.yml (passed via registryConfig)
Otherwise, it returns an embedded zot registry for local builds. The dataDir parameter sets persistent storage for the local registry; if empty, a temporary directory is used.
type RemoteRegistry ¶
type RemoteRegistry struct {
// contains filtered or unexported fields
}
RemoteRegistry is a passthrough registry for CI environments. Start and Stop are no-ops; Push pushes to the configured remote registry.
func NewRemoteRegistry ¶
func NewRemoteRegistry(address string) *RemoteRegistry
NewRemoteRegistry creates a remote registry with the given address. Media types default to auto-detection (Docker Hub → Docker-scheme, everything else → OCI). Callers wanting an explicit override should use NewRemoteRegistryWithMediaTypes.
func NewRemoteRegistryWithMediaTypes ¶ added in v0.10.0
func NewRemoteRegistryWithMediaTypes(address string, dockerMediaTypes *bool) *RemoteRegistry
NewRemoteRegistryWithMediaTypes creates a remote registry with an explicit Docker-media-types override. Pass nil to fall back to auto-detection, a non-nil value to force the choice.
func (*RemoteRegistry) Address ¶
func (r *RemoteRegistry) Address() string
func (*RemoteRegistry) IsLocal ¶
func (r *RemoteRegistry) IsLocal() bool
func (*RemoteRegistry) Push ¶
func (r *RemoteRegistry) Push(_ context.Context, imageName, tag, ociTarPath string) error
func (*RemoteRegistry) UseDockerMediaTypes ¶ added in v0.10.0
func (r *RemoteRegistry) UseDockerMediaTypes() bool
UseDockerMediaTypes reports whether image manifests and the manifest list should use Docker-scheme media types. An explicit override from the registry config wins; otherwise the address is auto-detected.
type ZotRegistry ¶
type ZotRegistry struct {
// contains filtered or unexported fields
}
ZotRegistry is an embedded OCI registry for local development builds. It runs zot in-process on a random port.
func NewZotRegistry ¶
func NewZotRegistry(dataDir string) *ZotRegistry
NewZotRegistry creates a new ZotRegistry instance. If dataDir is non-empty, it is used as persistent storage (created if needed). Otherwise a temporary directory is used and cleaned up on Stop.
func (*ZotRegistry) Address ¶
func (z *ZotRegistry) Address() string
func (*ZotRegistry) IsLocal ¶
func (z *ZotRegistry) IsLocal() bool
func (*ZotRegistry) Push ¶
func (z *ZotRegistry) Push(_ context.Context, imageName, tag, ociTarPath string) error
func (*ZotRegistry) UseDockerMediaTypes ¶ added in v0.10.0
func (z *ZotRegistry) UseDockerMediaTypes() bool
UseDockerMediaTypes reports false: zot is a local OCI-native registry with no reason to emit Docker-scheme types.