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 FindImagesInOCIManifests(manifests []ocispec.Descriptor) ([]string, error)
- func GetManifestsFromArchive(ctx context.Context, imageArchive string) (_ []ocispec.Descriptor, err error)
- func IsIndex(mediaType string) bool
- func IsManifest(mediaType string) bool
- 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(insecure bool) []crane.Option
- func WithPullAuth(ri state.RegistryInfo) crane.Option
- func WithPushAuth(ri state.RegistryInfo) crane.Option
- type PullOptions
- type PulledImage
- 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 FindImagesInOCIManifests ¶ added in v0.77.0
func FindImagesInOCIManifests(manifests []ocispec.Descriptor) ([]string, error)
FindImagesInOCIManifests takes a list of OCI Descriptors and returns image References
func GetManifestsFromArchive ¶ added in v0.77.0
func GetManifestsFromArchive(ctx context.Context, imageArchive string) (_ []ocispec.Descriptor, err error)
GetManifestsFromArchive take an image archive and returns a list of image descriptors
func IsIndex ¶ added in v0.77.0
IsIndex reports whether the media type represents an OCI image index.
func IsManifest ¶ added in v0.77.0
IsManifest reports whether the media type represents an OCI manifest.
func OnlyHasImageLayers ¶
OnlyHasImageLayers returns true when an OCI manifest only contains 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 flag.
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 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 PulledImage ¶ added in v0.77.0
PulledImage describes an image that landed in the destination OCI layout.
func Pull ¶
func Pull(ctx context.Context, imageList []transform.Image, destinationDirectory string, opts PullOptions) ([]PulledImage, 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) (_ []PulledImage, err error)
Unpack extracts an image tar and loads it into an OCI layout directory. It returns a list of PulledImage for all images in the tar.
type PushOptions ¶
type PushOptions struct {
OCIConcurrency int
NoChecksum bool
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.