image

package
v0.33.15 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AnnotationImageReferenceName = "org.opencontainers.image.ref.name"
	AnnotationImageShortTag      = "io.deckhouse.image.short_tag"
)

Variables

View Source
var ErrImageMetaNotFound = fmt.Errorf("image metadata not found")

Functions

func CountManifests added in v0.30.20

func CountManifests(paths []layout.Path) int

CountManifests returns the total image-manifest count across the given layout paths. It feeds the pull summary's per-phase image counts, read from the OCI layouts before packing deletes them (bundle.Pack) - no extra registry call. Unreadable paths (e.g. layouts absent in a dry-run) are skipped.

func CountManifestsMatching added in v0.30.20

func CountManifestsMatching(paths []layout.Path, match func(annotations map[string]string) bool) int

CountManifestsMatching counts manifests whose descriptor annotations satisfy match. It feeds summary subsets in the same single pass - notably the VEX tally (".att" short-tag). Unreadable paths are skipped, as in CountManifests.

func SplitImageRefByRepoAndTag

func SplitImageRefByRepoAndTag(imageReferenceString string) (string, string)

Types

type Image

type Image struct {
	v1.Image
	// contains filtered or unexported fields
}

func NewImage

func NewImage(img v1.Image, opts ...ImageOption) (*Image, error)

func (*Image) Extract

func (i *Image) Extract() io.ReadCloser

Extract flattens the image to a single layer and returns ReadCloser for fetching the content The repository is determined by the chained WithSegment() calls

func (*Image) GetDigestReference

func (i *Image) GetDigestReference() (string, error)

func (*Image) GetMetadata

func (i *Image) GetMetadata() (pkg.ImageMeta, error)

func (*Image) GetTagReference

func (i *Image) GetTagReference() (string, error)

func (*Image) SetMetadata

func (i *Image) SetMetadata(metadata pkg.ImageMeta)

type ImageLayout

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

func NewImageLayout

func NewImageLayout(path string) (*ImageLayout, error)

func (*ImageLayout) AddImage

func (l *ImageLayout) AddImage(img pkg.RegistryImage, tag string) error

AddImage stores img in the layout under tag.

Idempotent for the (tag, digest) pair: a repeat call with the same tag and manifest digest is a no-op. AppendImage always appends a new descriptor to index.json, so without this guard repeated pulls of the same image set would create duplicate descriptors (and duplicate pushes later).

  • same tag, different digest: falls through to AppendImage (re-tag); the push pipeline dedupes such cases with last-wins semantics.
  • metaByTag is recorded only after AppendImage succeeds. Recording earlier would poison the guard on a failed write: a retry would see the pair as done and silently skip the image.

func (*ImageLayout) AddIndex added in v0.33.8

func (l *ImageLayout) AddIndex(idx v1.ImageIndex, tag, tagReference string) error

AddIndex stores idx in the layout under tag. The index goes in whole: per-platform children, their descriptors, and index annotations stay as published. Use it for multi-platform images (e.g. CLI plugins), where flattening to a single platform would lose the rest. tagReference is the full registry reference for the descriptor annotations, same as AddImage records.

Idempotent for the (tag, digest) pair, same guard order as AddImage: metaByTag is written only after AppendIndex succeeds, so a failed write is retried, not skipped.

func (*ImageLayout) GetImage

func (l *ImageLayout) GetImage(tag string) (pkg.RegistryImage, error)

func (*ImageLayout) GetMeta

func (l *ImageLayout) GetMeta(tag string) (*ImageMeta, error)

func (*ImageLayout) Path

func (l *ImageLayout) Path() layout.Path

func (*ImageLayout) TagImage

func (l *ImageLayout) TagImage(imageDigest v1.Hash, tag string) error

type ImageMeta

type ImageMeta struct {
	TagReference    string
	DigestReference string

	Digest *v1.Hash
}

func NewImageMeta

func NewImageMeta(tagReference string, digestReference string, digest *v1.Hash) *ImageMeta

func (*ImageMeta) GetDigest

func (m *ImageMeta) GetDigest() *v1.Hash

func (*ImageMeta) GetDigestReference

func (m *ImageMeta) GetDigestReference() string

func (*ImageMeta) GetTagReference

func (m *ImageMeta) GetTagReference() string

type ImageOption

type ImageOption func(img *Image)

func WithFetchingMetadata

func WithFetchingMetadata(tagReference string) ImageOption

WithFetchingMetadata enables fetching and filling image metadata (digest, digest reference) during NewImage call

func WithMetadata

func WithMetadata(metadata *ImageMeta) ImageOption

Jump to

Keyboard shortcuts

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