Documentation
¶
Overview ¶
Package images provides functions for building and pushing images.
Package images provides image-related utilities for Zarf ¶
Package images provides functions for building and pushing images.
Package images provides functions for building and pushing images.
Index ¶
- Constants
- func NoopOpt(*crane.Options)
- func OnlyHasImageLayers(manifest ocispec.Manifest) bool
- func Ping(ctx context.Context, plainHTTP bool, registryURL string, client *auth.Client) (err error)
- func Pull(ctx context.Context, cfg PullConfig) (map[transform.Image]ocispec.Manifest, error)
- func Push(ctx context.Context, cfg PushConfig) error
- func ShouldUsePlainHTTP(ctx context.Context, registryURL string, client *auth.Client) (bool, error)
- func WithBasicAuth(username, password string) crane.Option
- func WithGlobalInsecureFlag() []crane.Option
- func WithPullAuth(ri state.RegistryInfo) crane.Option
- func WithPushAuth(ri state.RegistryInfo) crane.Option
- type PullConfig
- type PushConfig
- type Report
- type TrackedTarget
- type Tracker
Constants ¶
const ( //DockerMediaTypeManifest is the Legacy Docker manifest format, replaced by OCI manifest DockerMediaTypeManifest = "application/vnd.docker.distribution.manifest.v2+json" // DockerMediaTypeManifestList is the legacy Docker manifest list, replaced by OCI index DockerMediaTypeManifestList = "application/vnd.docker.distribution.manifest.list.v2+json" )
const ( DockerLayer = "application/vnd.docker.image.rootfs.diff.tar.gzip" DockerUncompressedLayer = "application/vnd.docker.image.rootfs.diff.tar" DockerForeignLayer = "application/vnd.docker.image.rootfs.foreign.diff.tar.gzip" )
Legacy Docker image layers
Variables ¶
This section is empty.
Functions ¶
func OnlyHasImageLayers ¶ added in v0.51.0
OnlyHasImageLayers returns true when an OCI manifest only containers container image layers.
func ShouldUsePlainHTTP ¶ added in v0.59.0
ShouldUsePlainHTTP returns true if the registryURL is an http endpoint This is inspired by the Crane functionality to determine the schema to be used - https://github.com/google/go-containerregistry/blob/main/pkg/v1/remote/transport/ping.go Zarf relies heavily on this logic, as the internal registry communicates over HTTP, however we want Zarf to be flexible should the registry be over https in the future
func WithBasicAuth ¶
WithBasicAuth returns an option for crane that sets basic auth.
func WithGlobalInsecureFlag ¶
WithGlobalInsecureFlag returns an option for crane that configures insecure based upon Zarf's global --insecure-skip-tls-verify (and --insecure) flags.
func WithPullAuth ¶
func WithPullAuth(ri state.RegistryInfo) crane.Option
WithPullAuth returns an option for crane that sets pull auth from a given registry info.
func WithPushAuth ¶
func WithPushAuth(ri state.RegistryInfo) crane.Option
WithPushAuth returns an option for crane that sets push auth from a given registry info.
Types ¶
type PullConfig ¶
type PullConfig struct { OCIConcurrency int DestinationDirectory string ImageList []transform.Image Arch string RegistryOverrides map[string]string CacheDirectory string PlainHTTP bool InsecureSkipTLSVerify bool ResponseHeaderTimeout time.Duration }
PullConfig is the configuration for pulling images.
type PushConfig ¶
type PushConfig struct { OCIConcurrency int SourceDirectory string ImageList []transform.Image RegistryInfo state.RegistryInfo NoChecksum bool Arch string Retries int PlainHTTP bool InsecureSkipTLSVerify bool Cluster *cluster.Cluster ResponseHeaderTimeout time.Duration }
PushConfig is the configuration for pushing images.
type Report ¶ added in v0.58.0
type Report func(bytesRead, totalBytes int64)
Report defines a function to log progress
type TrackedTarget ¶ added in v0.58.0
type TrackedTarget struct { oras.Target *Tracker }
TrackedTarget wraps an oras.Target to track progress
func NewTrackedTarget ¶ added in v0.58.0
func NewTrackedTarget(target oras.Target, totalBytes int64, reporter Report) *TrackedTarget
NewTrackedTarget creates a new TrackedTarget
func (*TrackedTarget) Push ¶ added in v0.58.0
func (tt *TrackedTarget) Push(ctx context.Context, desc ocispec.Descriptor, content io.Reader) error
Push wraps the target push method with an appropriate tracked reader.
type Tracker ¶ added in v0.58.0
type Tracker struct {
// contains filtered or unexported fields
}
Tracker reports progress against totalBytes as bytesRead gets updated
func (*Tracker) StartReporting ¶ added in v0.58.0
StartReporting starts the reporting goroutine
func (*Tracker) StopReporting ¶ added in v0.58.0
func (tt *Tracker) StopReporting()
StopReporting stops the reporting goroutine