layout

package
v0.34.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

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.

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"

	SeedImagesDir        = "seed-images"
	InjectorBinary       = "zarf-injector"
	InjectorPayloadTarGz = "payload.tgz"
)

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

func IsNotLoaded

func IsNotLoaded(err error) bool

IsNotLoaded checks if an error is ErrNotLoaded.

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(component types.ZarfComponent, cleanupTemp bool) (err error)

Archive archives a component.

func (*Components) Create

func (c *Components) Create(component types.ZarfComponent) (cp *ComponentPaths, err error)

Create creates a new component directory structure.

func (*Components) Unarchive

func (c *Components) Unarchive(component types.ZarfComponent) (err 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 InjectionMadnessPaths

type InjectionMadnessPaths struct {
	InjectionBinary      string
	SeedImagesDir        string
	InjectorPayloadTarGz string
}

InjectionMadnessPaths contains paths for injection madness.

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 added in v0.32.6

func (pp *PackagePaths) ArchivePackage(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 added in v0.32.6

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 added in v0.32.6

func (pp *PackagePaths) ReadZarfYAML() (pkg types.ZarfPackage, warnings []string, err 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 added in v0.32.6

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() (err 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 added in v0.32.6

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

OutputSBOMFiles outputs SBOM files into outputDir.

func (*SBOMs) StageSBOMViewFiles added in v0.32.6

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

StageSBOMViewFiles copies SBOM viewer HTML files to the Zarf SBOM directory.

func (*SBOMs) Unarchive

func (s *SBOMs) Unarchive() (err 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