Documentation
¶
Overview ¶
Package layout contains functions for interacting with Zarf packages.
Index ¶
- Constants
- Variables
- func PackageChart(ctx context.Context, chart v1alpha1.ZarfChart, packagePath string, ...) error
- func PackageManifest(ctx context.Context, manifest v1alpha1.ZarfManifest, compBuildPath string, ...) error
- type AssembleOptions
- type AssembleSkeletonOptions
- type ComponentDir
- type NoSBOMAvailableError
- type PackageLayout
- func AssemblePackage(ctx context.Context, pkg v1alpha1.ZarfPackage, packagePath string, ...) (*PackageLayout, error)
- func AssembleSkeleton(ctx context.Context, pkg v1alpha1.ZarfPackage, packagePath string, ...) (*PackageLayout, error)
- func LoadFromDir(ctx context.Context, dirPath string, opts PackageLayoutOptions) (*PackageLayout, error)
- func LoadFromTar(ctx context.Context, tarPath string, opts PackageLayoutOptions) (*PackageLayout, error)
- func (p *PackageLayout) Archive(ctx context.Context, dirPath string, maxPackageSize int) (string, error)
- func (p *PackageLayout) Cleanup() error
- func (p *PackageLayout) ContainsSBOM() bool
- func (p *PackageLayout) DirPath() string
- func (p *PackageLayout) FileName() (string, error)
- func (p *PackageLayout) Files() (map[string]string, error)
- func (p *PackageLayout) GetComponentDir(ctx context.Context, destPath, componentName string, ct ComponentDir) (_ string, err error)
- func (p *PackageLayout) GetImageDirPath() string
- func (p *PackageLayout) GetSBOM(ctx context.Context, destPath string) error
- func (p *PackageLayout) SignPackage(signingKeyPath, signingKeyPassword string) error
- type PackageLayoutOptions
Constants ¶
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.
Variables ¶
var ( // IndexPath is the path to the index.json file IndexPath = filepath.Join(ImagesDir, IndexJSON) // ImagesBlobsDir is the path to the directory containing the image blobs in the OCI package. ImagesBlobsDir = filepath.Join(ImagesDir, "blobs", "sha256") // OCILayoutPath is the path to the oci-layout file OCILayoutPath = filepath.Join(ImagesDir, OCILayout) )
Functions ¶
func PackageChart ¶ added in v0.60.0
func PackageChart(ctx context.Context, chart v1alpha1.ZarfChart, packagePath string, chartPath string, valuesFilePath string) error
PackageChart takes a Zarf Chart definition and packs it into a package layout
func PackageManifest ¶ added in v0.60.0
func PackageManifest(ctx context.Context, manifest v1alpha1.ZarfManifest, compBuildPath string, packagePath string) error
PackageManifest takes a Zarf manifest definition and packs it into a package layout
Types ¶
type AssembleOptions ¶
type AssembleOptions struct {
// Flavor causes the package to only include components with a matching `.components[x].only.flavor` or no flavor `.components[x].only.flavor` specified
Flavor string
// RegistryOverrides overrides the basepath of an OCI image with a path to a different registry
RegistryOverrides map[string]string
SigningKeyPath string
SigningKeyPassword string
SkipSBOM bool
// When DifferentialPackage is set the zarf package created only includes images and repos not in the differential package
DifferentialPackage v1alpha1.ZarfPackage
OCIConcurrency int
// CachePath is the path to the Zarf cache, used to cache images
CachePath string
}
AssembleOptions are the options for creating a package from a package object
type AssembleSkeletonOptions ¶
type AssembleSkeletonOptions struct {
SigningKeyPath string
SigningKeyPassword string
Flavor string
}
AssembleSkeletonOptions are the options for creating a skeleton package
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 NoSBOMAvailableError ¶
type NoSBOMAvailableError struct {
// contains filtered or unexported fields
}
NoSBOMAvailableError is returned when a user tries to access a package SBOM, but it is not available
func (*NoSBOMAvailableError) Error ¶
func (e *NoSBOMAvailableError) Error() string
type PackageLayout ¶
type PackageLayout struct {
Pkg v1alpha1.ZarfPackage
// contains filtered or unexported fields
}
PackageLayout manages the layout for a package.
func AssemblePackage ¶
func AssemblePackage(ctx context.Context, pkg v1alpha1.ZarfPackage, packagePath string, opts AssembleOptions) (*PackageLayout, error)
AssemblePackage takes a package definition and returns a package layout with all the resources collected
func AssembleSkeleton ¶
func AssembleSkeleton(ctx context.Context, pkg v1alpha1.ZarfPackage, packagePath string, opts AssembleSkeletonOptions) (*PackageLayout, error)
AssembleSkeleton creates a skeleton package and returns the path to the created package.
func LoadFromDir ¶
func LoadFromDir(ctx context.Context, dirPath string, opts PackageLayoutOptions) (*PackageLayout, error)
LoadFromDir loads and validates a package from the given directory path.
func LoadFromTar ¶
func LoadFromTar(ctx context.Context, tarPath string, opts PackageLayoutOptions) (*PackageLayout, error)
LoadFromTar unpacks the given archive (any compress/format) and loads it.
func (*PackageLayout) Archive ¶
func (p *PackageLayout) Archive(ctx context.Context, dirPath string, maxPackageSize int) (string, error)
Archive creates a tarball from the package layout and returns the path to that tarball
func (*PackageLayout) Cleanup ¶
func (p *PackageLayout) Cleanup() error
Cleanup removes any temporary directories created.
func (*PackageLayout) ContainsSBOM ¶
func (p *PackageLayout) ContainsSBOM() bool
ContainsSBOM checks if a package includes an SBOM
func (*PackageLayout) DirPath ¶
func (p *PackageLayout) DirPath() string
DirPath returns base directory of the package layout
func (*PackageLayout) FileName ¶
func (p *PackageLayout) FileName() (string, error)
FileName returns the name of the Zarf package should have when exported to the file system
func (*PackageLayout) Files ¶
func (p *PackageLayout) Files() (map[string]string, error)
Files returns a map of all the files in the package.
func (*PackageLayout) GetComponentDir ¶
func (p *PackageLayout) GetComponentDir(ctx context.Context, destPath, componentName string, ct ComponentDir) (_ string, err error)
GetComponentDir returns a path to the directory in the given component.
func (*PackageLayout) GetImageDirPath ¶
func (p *PackageLayout) GetImageDirPath() string
GetImageDirPath returns the path to the images directory
func (*PackageLayout) GetSBOM ¶
func (p *PackageLayout) GetSBOM(ctx context.Context, destPath string) error
GetSBOM outputs the SBOM data from the package to the given destination path.
func (*PackageLayout) SignPackage ¶
func (p *PackageLayout) SignPackage(signingKeyPath, signingKeyPassword string) error
SignPackage signs the zarf package
type PackageLayoutOptions ¶
type PackageLayoutOptions struct {
PublicKeyPath string
SkipSignatureValidation bool
IsPartial bool
Filter filters.ComponentFilterStrategy
}
PackageLayoutOptions are the options used when loading a package.