sources

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package sources contains core implementations of the PackageSource interface.

Package sources contains core implementations of the PackageSource interface.

Package sources contains core implementations of the PackageSource interface.

Package sources contains core implementations of the PackageSource interface.

Package sources contains core implementations of the PackageSource interface.

Package sources contains core implementations of the PackageSource interface.

Package sources contains core implementations of the PackageSource interface.

Package sources contains core implementations of the PackageSource interface.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrPkgKeyButNoSig is returned when a key was provided but the package is not signed
	ErrPkgKeyButNoSig = errors.New("a key was provided but the package is not signed - the package may be corrupted or the --key flag was erroneously specified")
	// ErrPkgSigButNoKey is returned when a package is signed but no key was provided
	ErrPkgSigButNoKey = errors.New("package is signed but no key was provided - add a key with the --key flag or use the --insecure flag and run the command again")
)

Functions

func Identify

func Identify(pkgSrc string) string

Identify returns the type of package source based on the provided package source string.

func NameFromMetadata

func NameFromMetadata(pkg *types.ZarfPackage, isSkeleton bool) string

NameFromMetadata generates a name from a package's metadata.

func RenameFromMetadata

func RenameFromMetadata(path string) (string, error)

RenameFromMetadata renames a tarball based on its metadata.

func ValidatePackageIntegrity

func ValidatePackageIntegrity(loaded *layout.PackagePaths, aggregateChecksum string, isPartial bool) error

ValidatePackageIntegrity validates the integrity of a package by comparing checksums

func ValidatePackageSignature

func ValidatePackageSignature(paths *layout.PackagePaths, publicKeyPath string) error

ValidatePackageSignature validates the signature of a package

Types

type ClusterSource

type ClusterSource struct {
	*types.ZarfPackageOptions
	*cluster.Cluster
}

ClusterSource is a package source for clusters.

func (*ClusterSource) Collect

func (s *ClusterSource) Collect(_ string) (string, error)

Collect collects a package from a cluster.

This is not implemented.

func (*ClusterSource) LoadPackage

func (s *ClusterSource) LoadPackage(_ *layout.PackagePaths, _ bool) error

LoadPackage loads a package from a cluster.

This is not implemented.

func (*ClusterSource) LoadPackageMetadata

func (s *ClusterSource) LoadPackageMetadata(dst *layout.PackagePaths, _ bool, _ bool) (err error)

LoadPackageMetadata loads package metadata from a cluster.

type OCISource

type OCISource struct {
	*types.ZarfPackageOptions
	*oci.OrasRemote
}

OCISource is a package source for OCI registries.

func (*OCISource) Collect

func (s *OCISource) Collect(dir string) (string, error)

Collect pulls a package from an OCI registry and writes it to a tarball.

func (*OCISource) LoadPackage

func (s *OCISource) LoadPackage(dst *layout.PackagePaths, unarchiveAll bool) (err error)

LoadPackage loads a package from an OCI registry.

func (*OCISource) LoadPackageMetadata

func (s *OCISource) LoadPackageMetadata(dst *layout.PackagePaths, wantSBOM bool, skipValidation bool) (err error)

LoadPackageMetadata loads a package's metadata from an OCI registry.

type PackageSource

type PackageSource interface {
	// LoadPackage loads a package from a source.
	LoadPackage(dst *layout.PackagePaths, unarchiveAll bool) error

	// LoadPackageMetadata loads a package's metadata from a source.
	LoadPackageMetadata(dst *layout.PackagePaths, wantSBOM bool, skipValidation bool) error

	// Collect relocates a package from its source to a tarball in a given destination directory.
	Collect(destinationDirectory string) (tarball string, err error)
}

PackageSource is an interface for package sources.

While this interface defines three functions, LoadPackage, LoadPackageMetadata, and Collect; only one of them should be used within a packager function.

These functions currently do not promise repeatability due to the side effect nature of loading a package.

Signature and integrity validation is up to the implementation of the package source.

`sources.ValidatePackageSignature` and `sources.ValidatePackageIntegrity` can be leveraged for this purpose.

func New

New returns a new PackageSource based on the provided package options.

func NewClusterSource

func NewClusterSource(pkgOpts *types.ZarfPackageOptions) (PackageSource, error)

NewClusterSource creates a new cluster source.

type SplitTarballSource

type SplitTarballSource struct {
	*types.ZarfPackageOptions
}

SplitTarballSource is a package source for split tarballs.

func (*SplitTarballSource) Collect

func (s *SplitTarballSource) Collect(dir string) (string, error)

Collect turns a split tarball into a full tarball.

func (*SplitTarballSource) LoadPackage

func (s *SplitTarballSource) LoadPackage(dst *layout.PackagePaths, unarchiveAll bool) (err error)

LoadPackage loads a package from a split tarball.

func (*SplitTarballSource) LoadPackageMetadata

func (s *SplitTarballSource) LoadPackageMetadata(dst *layout.PackagePaths, wantSBOM bool, skipValidation bool) (err error)

LoadPackageMetadata loads a package's metadata from a split tarball.

type TarballSource

type TarballSource struct {
	*types.ZarfPackageOptions
}

TarballSource is a package source for tarballs.

func (*TarballSource) Collect

func (s *TarballSource) Collect(dir string) (string, error)

Collect for the TarballSource is essentially an `mv`

func (*TarballSource) LoadPackage

func (s *TarballSource) LoadPackage(dst *layout.PackagePaths, unarchiveAll bool) (err error)

LoadPackage loads a package from a tarball.

func (*TarballSource) LoadPackageMetadata

func (s *TarballSource) LoadPackageMetadata(dst *layout.PackagePaths, wantSBOM bool, skipValidation bool) (err error)

LoadPackageMetadata loads a package's metadata from a tarball.

type URLSource

type URLSource struct {
	*types.ZarfPackageOptions
}

URLSource is a package source for http, https and sget URLs.

func (*URLSource) Collect

func (s *URLSource) Collect(dir string) (string, error)

Collect downloads a package from the source URL.

func (*URLSource) LoadPackage

func (s *URLSource) LoadPackage(dst *layout.PackagePaths, unarchiveAll bool) (err error)

LoadPackage loads a package from an http, https or sget URL.

func (*URLSource) LoadPackageMetadata

func (s *URLSource) LoadPackageMetadata(dst *layout.PackagePaths, wantSBOM bool, skipValidation bool) (err error)

LoadPackageMetadata loads a package's metadata from an http, https or sget URL.

Jump to

Keyboard shortcuts

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