layout

package
v0.45.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: Apache-2.0 Imports: 24 Imported by: 3

Documentation

Overview

Package layout contains functions for interacting with Zarf's package layout on disk.

Package layout contains functions for interacting with Zarf's package layout on disk.

Package layout contains functions for interacting with Zarf's package layout on disk.

Package layout contains functions for interacting with Zarf's package layout on disk.

Package layout contains functions for interacting with Zarf's package layout on disk.

Package layout contains functions for interacting with Zarf's package layout on disk.

Index

Constants

View Source
const (
	TempDir           = "temp"
	FilesDir          = "files"
	ChartsDir         = "charts"
	ReposDir          = "repos"
	ManifestsDir      = "manifests"
	DataInjectionsDir = "data"
	ValuesDir         = "values"

	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

View Source
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)
)
View Source
var ErrNotLoaded = fmt.Errorf("not loaded")

ErrNotLoaded is returned when a path is not loaded.

Functions

This section is empty.

Types

type ComponentPaths

type ComponentPaths struct {
	Base           string
	Temp           string
	Files          string
	Charts         string
	Values         string
	Repos          string
	Manifests      string
	DataInjections string
}

ComponentPaths contains paths for a component.

type ComponentSBOM

type ComponentSBOM struct {
	Files     []string
	Component *ComponentPaths
}

ComponentSBOM contains paths for a component's SBOM.

type Components

type Components struct {
	Base     string
	Dirs     map[string]*ComponentPaths
	Tarballs map[string]string
}

Components contains paths for components.

func (*Components) Archive

func (c *Components) Archive(ctx context.Context, component v1alpha1.ZarfComponent, cleanupTemp bool) error

Archive archives a component.

func (*Components) Create

func (c *Components) Create(component v1alpha1.ZarfComponent) (*ComponentPaths, error)

Create creates a new component directory structure.

func (*Components) Unarchive

func (c *Components) Unarchive(component v1alpha1.ZarfComponent) error

Unarchive unarchives a component.

type Images

type Images struct {
	Base      string
	Index     string
	OCILayout string
	Blobs     []string
}

Images contains paths for images.

func (*Images) AddBlob

func (i *Images) AddBlob(blob string)

AddBlob adds a blob to the Images struct.

func (*Images) AddV1Image

func (i *Images) AddV1Image(img v1.Image) error

AddV1Image adds a v1.Image to the Images struct.

type PackagePaths

type PackagePaths struct {
	Base      string
	ZarfYAML  string
	Checksums string

	Signature string

	Components Components
	SBOMs      SBOMs
	Images     Images
	// contains filtered or unexported fields
}

PackagePaths is the default package layout.

func New

func New(baseDir string) *PackagePaths

New returns a new PackagePaths struct.

func (*PackagePaths) AddImages

func (pp *PackagePaths) AddImages() *PackagePaths

AddImages sets the default image paths.

func (*PackagePaths) AddSBOMs

func (pp *PackagePaths) AddSBOMs() *PackagePaths

AddSBOMs sets the default sbom paths.

func (*PackagePaths) ArchivePackage

func (pp *PackagePaths) ArchivePackage(ctx context.Context, destinationTarball string, maxPackageSizeMB int) error

ArchivePackage creates an archive for a Zarf package.

func (*PackagePaths) Files

func (pp *PackagePaths) Files() map[string]string

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

func (*PackagePaths) GenerateChecksums

func (pp *PackagePaths) GenerateChecksums() (string, error)

GenerateChecksums walks through all of the files starting at the base path and generates a checksum file.

Each file within the basePath represents a layer within the Zarf package.

Returns a SHA256 checksum of the checksums.txt file.

func (*PackagePaths) IsLegacyLayout

func (pp *PackagePaths) IsLegacyLayout() bool

IsLegacyLayout returns true if the package is using the legacy layout.

func (*PackagePaths) MigrateLegacy

func (pp *PackagePaths) MigrateLegacy() (err error)

MigrateLegacy migrates a legacy package layout to the new layout.

func (*PackagePaths) ReadZarfYAML

func (pp *PackagePaths) ReadZarfYAML() (v1alpha1.ZarfPackage, []string, error)

ReadZarfYAML reads a zarf.yaml file into memory, checks if it's using the legacy layout, and migrates deprecated component configs.

func (*PackagePaths) SetFromLayers

func (pp *PackagePaths) SetFromLayers(layers []ocispec.Descriptor)

SetFromLayers maps layers to package paths.

func (*PackagePaths) SetFromPaths

func (pp *PackagePaths) SetFromPaths(paths []string)

SetFromPaths maps paths to package paths.

func (*PackagePaths) SignPackage

func (pp *PackagePaths) SignPackage(signingKeyPath, signingKeyPassword string, isInteractive bool) error

SignPackage signs the zarf.yaml in a Zarf package.

type SBOMs

type SBOMs struct {
	Path string
}

SBOMs contains paths for SBOMs.

func (*SBOMs) Archive

func (s *SBOMs) Archive() error

Archive archives the package's SBOMs.

func (*SBOMs) IsTarball

func (s *SBOMs) IsTarball() bool

IsTarball returns true if the SBOMs are a tarball.

func (*SBOMs) OutputSBOMFiles

func (s *SBOMs) OutputSBOMFiles(outputDir, packageName string) (string, error)

OutputSBOMFiles outputs SBOM files into outputDir.

func (*SBOMs) StageSBOMViewFiles

func (s *SBOMs) StageSBOMViewFiles() ([]string, []string, error)

StageSBOMViewFiles copies SBOM viewer HTML files to the Zarf SBOM directory. Returns sbomViewFiles, warnings, and an error.

func (*SBOMs) Unarchive

func (s *SBOMs) Unarchive() error

Unarchive unarchives the package's SBOMs.

Jump to

Keyboard shortcuts

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