layout

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Overview

Package layout is used to defining the distro package files

Index

Constants

View Source
const (
	// CargoshipLayerMediaTypeBlob is the media type for all Cargoship package layer blobs.
	CargoshipLayerMediaTypeBlob = "application/vnd.cargoship.layer.v1.blob"
	// CargoshipConfigMediaType is the media type for the Cargoship package manifest config.
	CargoshipConfigMediaType = "application/vnd.cargoship.config.v1+json"
	// OCITimestampFormat is the format used for the OCI timestamp annotation
	OCITimestampFormat = time.RFC3339
)

Variables

View Source
var ErrNoVerificationMaterial = errors.New("no verification material available")

ErrNoVerificationMaterial is returned when there is nothing to verify against. VerifyIfPossible tolerates this; all other verification errors are always fatal.

Functions

func AnnotationsFromMetadata added in v0.9.0

func AnnotationsFromMetadata(metadata distro.ZarfDistroMetadata) map[string]string

AnnotationsFromMetadata extracts OCI manifest annotations from Zarf package metadata.

Types

type ClusterPath

type ClusterPath struct {
	ManifestFile string
	BaseDir      string
}

ClusterPath object that contains the manifest file and base directory

func ResolveClusterPath

func ResolveClusterPath(path string) (ClusterPath, error)

ResolveClusterPath returns an object of ClusterPath from a given path

type Distro

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

Distro struct

func New

func New(cfg *types.DistroConfig) (*Distro, error)

New creates a new Distro object

type DistroLayout

type DistroLayout struct {
	Distro distro.ZarfDistro
	// contains filtered or unexported fields
}

DistroLayout struct

func LoadFromDir

func LoadFromDir(ctx context.Context, dirPath string, opts DistroLayoutOptions) (*DistroLayout, error)

LoadFromDir loads and validates a package from the given directory path.

func LoadFromTar

func LoadFromTar(ctx context.Context, tarPath string, opts DistroLayoutOptions) (*DistroLayout, error)

LoadFromTar unpacks the given archive (any compress/format) and loads it.

func NewDistroLayout

func NewDistroLayout(dir string, distro v1alpha1.ZarfDistro) *DistroLayout

NewDistroLayout returns an DistroLayout object

func (*DistroLayout) Archive

func (d *DistroLayout) Archive(ctx context.Context, dirPath string, _ int) (string, error)

Archive creates a tarball from the package layout and returns the path to that tarball

func (*DistroLayout) Cleanup

func (d *DistroLayout) Cleanup() error

Cleanup removes any temporary directories created.

func (*DistroLayout) Digest added in v0.9.0

func (d *DistroLayout) Digest() string

Digest returns the OCI manifest digest for this package layout.

func (*DistroLayout) DirPath

func (d *DistroLayout) DirPath() string

DirPath returns dirPath

func (*DistroLayout) Exists added in v0.9.0

func (d *DistroLayout) Exists(_ context.Context, target ocispec.Descriptor) (bool, error)

Exists implements oras.ReadOnlyTarget.

func (*DistroLayout) Fetch added in v0.9.0

Fetch implements oras.ReadOnlyTarget. It serves the manifest, config, or a layer blob identified by the descriptor's digest.

func (*DistroLayout) FileName

func (d *DistroLayout) FileName() (string, error)

FileName returns the name of the Zarf package should have when exported to the file system

func (*DistroLayout) Files added in v0.9.0

func (d *DistroLayout) Files() (map[string]string, error)

Files returns a map of all the files in the package.

func (*DistroLayout) GetImageDirPath

func (d *DistroLayout) GetImageDirPath() string

GetImageDirPath returns the path to where the image tar balls should be stored in

func (*DistroLayout) IsPushable added in v0.9.0

func (d *DistroLayout) IsPushable() bool

IsPushable reports whether this layout has a computed manifest cache and can be used as a push source. A layout with only a registry digest (e.g. from a partial OCI pull via SetRegistryDigest) returns false because the cache is nil.

func (*DistroLayout) IsSigned added in v0.9.0

func (d *DistroLayout) IsSigned() bool

IsSigned returns true if the package is signed. It first checks the package metadata (Build.Signed), then falls back to checking for the presence of a signature file for backward compatibility.

func (*DistroLayout) Resolve added in v0.9.0

func (d *DistroLayout) Resolve(_ context.Context, reference string) (ocispec.Descriptor, error)

Resolve implements oras.ReadOnlyTarget. It accepts the manifest digest or the package name as a reference.

func (*DistroLayout) SetRegistryDigest added in v0.9.0

func (d *DistroLayout) SetRegistryDigest(digest string)

SetRegistryDigest records the manifest digest as resolved from a registry. It replaces the locally-computed digest and clears the manifest cache, since the registry manifest may differ (e.g. partial OCI pulls). After this call the layout is no longer usable as an oras.ReadOnlyTarget for pushing.

func (*DistroLayout) SignPackage added in v0.9.0

func (d *DistroLayout) SignPackage(ctx context.Context, opts signing.SignBlobOptions) (err error)

SignPackage signs the zarf package using cosign with the provided options. If the options do not indicate signing should be performed (no key material configured), this is a no-op and returns nil.

func (*DistroLayout) TotalSize added in v0.9.0

func (d *DistroLayout) TotalSize() int64

TotalSize returns the total bytes that would be pushed for this package (all layers + config + manifest). Returns 0 if the manifest has not been computed.

func (*DistroLayout) VerifyPackageSignature added in v0.9.0

func (d *DistroLayout) VerifyPackageSignature(ctx context.Context, opts signing.VerifyBlobOptions) error

VerifyPackageSignature verifies the package signature

type DistroLayoutOptions

type DistroLayoutOptions struct {
	VerifyBlobOptions *signing.VerifyBlobOptions
	// VerificationStrategy specifies whether verification is enforced
	VerificationStrategy VerificationStrategy
}

DistroLayoutOptions struct

type DistroPath

type DistroPath struct {
	ManifestFile string
	BaseDir      string
}

DistroPath object that contains the manifest file and base directory

func ResolveDistroPath

func ResolveDistroPath(path string) (DistroPath, error)

ResolveDistroPath returns an object of DistroPath from a given path

type VerificationStrategy added in v0.9.0

type VerificationStrategy int

VerificationStrategy describes a strategy for determining whether to verify a package.

const (
	// VerifyIfPossible will attempt a verification, it will not error if verification
	// data is missing. But it will not stop processing if verification fails.
	VerifyIfPossible VerificationStrategy = iota
	// VerifyAlways will always attempt a verification, and will fail if the
	// verification fails.
	VerifyAlways
	// VerifyNever will skip all verification of a package.
	VerifyNever
)

Jump to

Keyboard shortcuts

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