layout

package
v0.47.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2025 License: Apache-2.0 Imports: 69 Imported by: 0

Documentation

Overview

Package layout contains functions for inteacting the Zarf packages.

Index

Constants

View Source
const (
	// This should be updated when a breaking change is introduced to the Zarf package structure.  See: https://github.com/zarf-dev/zarf/releases/tag/v0.27.0
	LastNonBreakingVersion   = "v0.27.0"
	ScriptsToActionsMigrated = "scripts-to-actions"
	PluralizeSetVariable     = "pluralize-set-variable"
)

List of migrations tracked in the zarf.yaml build data.

View Source
const (
	ZarfYAML  = "zarf.yaml"
	Signature = "zarf.yaml.sig"
	Checksums = "checksums.txt"

	ImagesDir     = "images"
	ComponentsDir = "components"

	SBOMDir = "zarf-sbom"
	SBOMTar = "sboms.tar"

	IndexJSON = "index.json"
	OCILayout = "oci-layout"
)

Constants used in the default package layout.

View Source
const (
	// ZarfConfigMediaType is the media type for the manifest config
	ZarfConfigMediaType = "application/vnd.zarf.config.v1+json"
	// ZarfLayerMediaTypeBlob is the media type for all Zarf layers due to the range of possible content
	ZarfLayerMediaTypeBlob = "application/vnd.zarf.layer.v1.blob"
)

Variables

This section is empty.

Functions

func CreateSkeleton added in v0.42.0

func CreateSkeleton(ctx context.Context, packagePath string, opt CreateOptions) (string, error)

CreateSkeleton creates a skeleton package and returns the path to the created package.

func LoadPackage added in v0.47.0

func LoadPackage(ctx context.Context, packagePath, flavor string, setVariables map[string]string) (v1alpha1.ZarfPackage, error)

LoadPackage returns a validated package definition after flavors, imports, and variables are applied.

func ParseZarfPackage added in v0.42.0

func ParseZarfPackage(b []byte) (v1alpha1.ZarfPackage, error)

ParseZarfPackage parses the yaml passed as a byte slice and applies potential schema migrations.

func ReferenceFromMetadata added in v0.42.2

func ReferenceFromMetadata(registryLocation string, pkg v1alpha1.ZarfPackage) (string, error)

Types

type ComponentDir

type ComponentDir string

ComponentDir is the type for the different directories in a component.

const (
	RepoComponentDir      ComponentDir = "repos"
	FilesComponentDir     ComponentDir = "files"
	ChartsComponentDir    ComponentDir = "charts"
	ManifestsComponentDir ComponentDir = "manifests"
	DataComponentDir      ComponentDir = "data"
	ValuesComponentDir    ComponentDir = "values"
)

Different component directory types.

type CreateOptions added in v0.42.0

type CreateOptions struct {
	Flavor                  string
	RegistryOverrides       map[string]string
	SigningKeyPath          string
	SigningKeyPassword      string
	SetVariables            map[string]string
	SkipSBOM                bool
	DifferentialPackagePath string
}

CreateOptions are the options for creating a skeleton package.

type PackageLayout

type PackageLayout struct {
	Pkg v1alpha1.ZarfPackage
	// contains filtered or unexported fields
}

PackageLayout manages the layout for a package.

func CreatePackage added in v0.47.0

func CreatePackage(ctx context.Context, packagePath string, opt CreateOptions) (*PackageLayout, error)

func LoadFromDir

func LoadFromDir(ctx context.Context, dirPath string, opt PackageLayoutOptions) (*PackageLayout, error)

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

func LoadFromTar

func LoadFromTar(ctx context.Context, tarPath string, opt PackageLayoutOptions) (*PackageLayout, error)

LoadFromTar unpacks the give compressed package and loads it.

func (*PackageLayout) Archive added in v0.47.0

func (p *PackageLayout) Archive(ctx context.Context, dirPath string, maxPackageSize int) error

func (*PackageLayout) Cleanup

func (p *PackageLayout) Cleanup() error

Cleanup removes any temporary directories created.

func (*PackageLayout) Files added in v0.42.2

func (p *PackageLayout) Files() (map[string]string, error)

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

func (*PackageLayout) GetComponentDir

func (p *PackageLayout) GetComponentDir(destPath, componentName string, ct ComponentDir) (string, error)

GetComponentDir returns a path to the directory in the given component.

func (*PackageLayout) GetImage

func (p *PackageLayout) GetImage(ref transform.Image) (registryv1.Image, error)

GetImage returns the image with the given reference in the package layout.

func (*PackageLayout) GetSBOM

func (p *PackageLayout) GetSBOM(destPath string) (string, error)

GetSBOM outputs the SBOM data from the package to the give destination path.

type PackageLayoutOptions

type PackageLayoutOptions struct {
	PublicKeyPath           string
	SkipSignatureValidation bool
	IsPartial               bool
}

PackageLayoutOptions are the options used when loading a package.

type Remote added in v0.42.2

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

Remote is a wrapper around the Oras remote repository with zarf specific functions

func NewRemote added in v0.42.2

func NewRemote(ctx context.Context, url string, platform ocispec.Platform, mods ...oci.Modifier) (*Remote, error)

NewRemote returns an oras remote repository client and context for the given url with zarf opination embedded.

func (*Remote) Push added in v0.42.2

func (r *Remote) Push(ctx context.Context, pkgLayout *PackageLayout, concurrency int) (err error)

Push pushes the given package layout to the remote registry.

Jump to

Keyboard shortcuts

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