Documentation
¶
Overview ¶
Package layout contains functions for interacting with Zarf packages.
Index ¶
- Constants
- func CreateSkeleton(ctx context.Context, packagePath string, opt SkeletonCreateOptions) (string, error)
- func LoadPackageDefinition(ctx context.Context, packagePath, flavor string, ...) (v1alpha1.ZarfPackage, error)
- func ParseZarfPackage(ctx context.Context, b []byte) (v1alpha1.ZarfPackage, error)
- func ReferenceFromMetadata(registryLocation string, pkg v1alpha1.ZarfPackage) (string, error)
- type AssembleOptions
- type ComponentDir
- type CreateOptions
- type NoSBOMAvailableError
- type PackageLayout
- func AssemblePackage(ctx context.Context, pkg v1alpha1.ZarfPackage, packagePath string, ...) (*PackageLayout, error)
- func CreatePackage(ctx context.Context, packagePath string, opt CreateOptions) (*PackageLayout, error)
- func LoadFromDir(ctx context.Context, dirPath string, opt PackageLayoutOptions) (*PackageLayout, error)
- func LoadFromTar(ctx context.Context, tarPath string, opt PackageLayoutOptions) (*PackageLayout, error)
- func (p *PackageLayout) Archive(ctx context.Context, dirPath string, maxPackageSize int) error
- func (p *PackageLayout) Cleanup() error
- func (p *PackageLayout) ContainsSBOM() bool
- func (p *PackageLayout) DirPath() string
- func (p *PackageLayout) Files() (map[string]string, error)
- func (p *PackageLayout) GetComponentDir(ctx context.Context, destPath, componentName string, ct ComponentDir) (string, error)
- func (p *PackageLayout) GetImageDir() string
- func (p *PackageLayout) GetSBOM(ctx context.Context, destPath string) error
- type PackageLayoutOptions
- type Remote
- type SkeletonCreateOptions
Constants ¶
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.
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.
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" )
const CreateTimestampFormat = time.RFC1123Z
CreateTimestampFormat is the format used for the build data timestamp. If this format is changed - zarf will need to handle mismatch between older formats and the new format.
const OCITimestampFormat = time.RFC3339
Variables ¶
This section is empty.
Functions ¶
func CreateSkeleton ¶ added in v0.42.0
func CreateSkeleton(ctx context.Context, packagePath string, opt SkeletonCreateOptions) (string, error)
CreateSkeleton creates a skeleton package and returns the path to the created package.
func LoadPackageDefinition ¶ added in v0.52.0
func LoadPackageDefinition(ctx context.Context, packagePath, flavor string, setVariables map[string]string) (v1alpha1.ZarfPackage, error)
LoadPackageDefinition returns a validated package definition after flavors, imports, and variables are applied.
func ParseZarfPackage ¶ added in v0.42.0
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 AssembleOptions ¶ added in v0.55.6
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 // DifferentialPackagePath causes a differential package to be created that only contains images and repos not included in the package at the given path DifferentialPackagePath string OCIConcurrency int }
AssembleOptions are the options for creating a package from a package object
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 { AssembleOptions SetVariables map[string]string }
CreateOptions are the options for creating a package from a definition.
type NoSBOMAvailableError ¶ added in v0.49.1
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 ¶ added in v0.49.1
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 ¶ added in v0.55.6
func AssemblePackage(ctx context.Context, pkg v1alpha1.ZarfPackage, packagePath string, opt AssembleOptions) (*PackageLayout, error)
AssemblePackage takes a package definition and returns a package layout with all the resources collected
func CreatePackage ¶ added in v0.47.0
func CreatePackage(ctx context.Context, packagePath string, opt CreateOptions) (*PackageLayout, error)
CreatePackage takes a zarf.yaml at the package path and returns a PackageLayout of the final package
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 given archive (any compress/format) and loads it.
func (*PackageLayout) Cleanup ¶
func (p *PackageLayout) Cleanup() error
Cleanup removes any temporary directories created.
func (*PackageLayout) ContainsSBOM ¶ added in v0.55.6
func (p *PackageLayout) ContainsSBOM() bool
Contains SBOM checks if a package includes an SBOM
func (*PackageLayout) DirPath ¶ added in v0.55.6
func (p *PackageLayout) DirPath() string
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(ctx context.Context, destPath, componentName string, ct ComponentDir) (string, error)
GetComponentDir returns a path to the directory in the given component.
func (*PackageLayout) GetImageDir ¶ added in v0.51.0
func (p *PackageLayout) GetImageDir() string
type PackageLayoutOptions ¶
type PackageLayoutOptions struct { PublicKeyPath string SkipSignatureValidation bool IsPartial bool Filter filters.ComponentFilterStrategy }
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