images

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 1, 2026 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

Package images is functionality related to interacting with oci images. This also stems from zarf-dev/zarf

Index

Constants

View Source
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"
)

Variables

This section is empty.

Functions

func Ping

func Ping(ctx context.Context, plainHTTP bool, registryURL string, client *auth.Client) (err error)

Ping verifies if a user can connect to a registry

func ShouldUsePlainHTTP

func ShouldUsePlainHTTP(ctx context.Context, registryURL string, client *auth.Client) (bool, error)

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

Types

type ImageWithManifest

type ImageWithManifest struct {
	Image    transform.Image
	Manifest ocispec.Manifest
}

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.

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 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

func DefaultReport

func DefaultReport(l *slog.Logger, msg string, imageName string) Report

DefaultReport returns a default report function

type TrackedTarget

type TrackedTarget struct {
	oras.Target
	*Tracker
}

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

type Tracker

type Tracker struct {
	// contains filtered or unexported fields
}

Tracker reports progress against totalBytes as bytesRead gets updated

func (*Tracker) StartReporting

func (tt *Tracker) StartReporting(ctx context.Context)

StartReporting starts the reporting goroutine

func (*Tracker) StopReporting

func (tt *Tracker) StopReporting()

StopReporting stops the reporting goroutine.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL