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.
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 Push(ctx context.Context, imageList []transform.Image, sourceDirectory string, ...) 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 ImageWithManifest
- type PullOptions
- type PushOptions
- type RegistryOverride
- 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 ¶
OnlyHasImageLayers returns true when an OCI manifest only containers container image layers.
func Push ¶
func Push(ctx context.Context, imageList []transform.Image, sourceDirectory string, registryInfo state.RegistryInfo, cfg PushOptions) error
Push pushes images to a registry.
func ShouldUsePlainHTTP ¶
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 ImageWithManifest ¶ added in v0.68.0
ImageWithManifest represents an image reference and its associated OCI manifest.
func Pull ¶
func Pull(ctx context.Context, imageList []transform.Image, destinationDirectory string, opts PullOptions) ([]ImageWithManifest, error)
Pull pulls all images to the destination directory.
func Unpack ¶ added in v0.68.0
func Unpack(ctx context.Context, imageArchive v1alpha1.ImageArchive, destDir string, arch string) (_ []ImageWithManifest, err error)
Unpack extracts an image tar and loads it into an OCI layout directory. It returns a list of ImageWithManifest for all images in the tar.
type PullOptions ¶
type PullOptions struct {
OCIConcurrency int
Arch string
RegistryOverrides []RegistryOverride
CacheDirectory string
PlainHTTP bool
InsecureSkipTLSVerify bool
ResponseHeaderTimeout time.Duration
}
PullOptions is the configuration for pulling images.
type PushOptions ¶
type PushOptions struct {
OCIConcurrency int
NoChecksum bool
Arch string
Retries int
PlainHTTP bool
InsecureSkipTLSVerify bool
Cluster *cluster.Cluster
ResponseHeaderTimeout time.Duration
}
PushOptions is the configuration for pushing images.
type RegistryOverride ¶
type RegistryOverride struct {
// Source describes the source registry.
// May be of the form:
// - docker.io/library
// - docker.io
Source string
// Override replaces the source registry as a string prefix.
Override string
}
RegistryOverride describes an override for a specific registry.
type Report ¶
type Report func(bytesRead, totalBytes int64)
Report defines a function to log progress
type TrackedTarget ¶
TrackedTarget wraps an oras.Target to track progress
func NewTrackedTarget ¶
func NewTrackedTarget(target oras.Target, totalBytes int64, reporter Report) *TrackedTarget
NewTrackedTarget creates a new TrackedTarget
func (*TrackedTarget) Push ¶
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 ¶
type Tracker struct {
// contains filtered or unexported fields
}
Tracker reports progress against totalBytes as bytesRead gets updated
func (*Tracker) StartReporting ¶
StartReporting starts the reporting goroutine
func (*Tracker) StopReporting ¶
func (tt *Tracker) StopReporting()
StopReporting stops the reporting goroutine