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 ¶
- Variables
- func GetInitPackageName() string
- func GetValidPackageExtensions() [2]string
- func Identify(pkgSrc string) string
- func IsValidFileExtension(filename string) bool
- func NameFromMetadata(pkg *v1alpha1.ZarfPackage, isSkeleton bool) string
- func PkgSuffix(uncompressed bool) (suffix string)
- func RenameFromMetadata(path string) (string, error)
- func ValidatePackageIntegrity(loaded *layout.PackagePaths, aggregateChecksum string, isPartial bool) error
- func ValidatePackageSignature(ctx context.Context, paths *layout.PackagePaths, publicKeyPath string) error
- type ClusterSource
- func (s *ClusterSource) Collect(_ context.Context, _ string) (string, error)
- func (s *ClusterSource) LoadPackage(_ context.Context, _ *layout.PackagePaths, _ filters.ComponentFilterStrategy, ...) (v1alpha1.ZarfPackage, []string, error)
- func (s *ClusterSource) LoadPackageMetadata(ctx context.Context, dst *layout.PackagePaths, _ bool, _ bool) (v1alpha1.ZarfPackage, []string, error)
- type OCISource
- func (s *OCISource) Collect(ctx context.Context, dir string) (string, error)
- func (s *OCISource) LoadPackage(ctx context.Context, dst *layout.PackagePaths, ...) (pkg v1alpha1.ZarfPackage, warnings []string, err error)
- func (s *OCISource) LoadPackageMetadata(ctx context.Context, dst *layout.PackagePaths, wantSBOM bool, ...) (pkg v1alpha1.ZarfPackage, warnings []string, err error)
- type PackageSource
- type SplitTarballSource
- func (s *SplitTarballSource) Collect(ctx context.Context, dir string) (string, error)
- func (s *SplitTarballSource) LoadPackage(ctx context.Context, dst *layout.PackagePaths, ...) (pkg v1alpha1.ZarfPackage, warnings []string, err error)
- func (s *SplitTarballSource) LoadPackageMetadata(ctx context.Context, dst *layout.PackagePaths, wantSBOM bool, ...) (pkg v1alpha1.ZarfPackage, warnings []string, err error)
- type TarballSource
- func (s *TarballSource) Collect(_ context.Context, dir string) (string, error)
- func (s *TarballSource) LoadPackage(ctx context.Context, dst *layout.PackagePaths, ...) (pkg v1alpha1.ZarfPackage, warnings []string, err error)
- func (s *TarballSource) LoadPackageMetadata(ctx context.Context, dst *layout.PackagePaths, wantSBOM bool, ...) (pkg v1alpha1.ZarfPackage, warnings []string, err error)
- type URLSource
- func (s *URLSource) Collect(ctx context.Context, dir string) (string, error)
- func (s *URLSource) LoadPackage(ctx context.Context, dst *layout.PackagePaths, ...) (pkg v1alpha1.ZarfPackage, warnings []string, err error)
- func (s *URLSource) LoadPackageMetadata(ctx context.Context, dst *layout.PackagePaths, wantSBOM bool, ...) (pkg v1alpha1.ZarfPackage, warnings []string, err error)
Constants ¶
This section is empty.
Variables ¶
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 --skip-signature-validation flag and run the command again") )
Functions ¶
func GetInitPackageName ¶
func GetInitPackageName() string
GetInitPackageName returns the formatted name of the init package.
func GetValidPackageExtensions ¶
func GetValidPackageExtensions() [2]string
GetValidPackageExtensions returns the valid package extensions.
func Identify ¶
Identify returns the type of package source based on the provided package source string.
func IsValidFileExtension ¶
IsValidFileExtension returns true if the filename has a valid package extension.
func NameFromMetadata ¶
func NameFromMetadata(pkg *v1alpha1.ZarfPackage, isSkeleton bool) string
NameFromMetadata generates a name from a package's metadata.
func RenameFromMetadata ¶
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(ctx context.Context, 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) LoadPackage ¶
func (s *ClusterSource) LoadPackage(_ context.Context, _ *layout.PackagePaths, _ filters.ComponentFilterStrategy, _ bool) (v1alpha1.ZarfPackage, []string, error)
LoadPackage loads a package from a cluster.
This is not implemented.
func (*ClusterSource) LoadPackageMetadata ¶
func (s *ClusterSource) LoadPackageMetadata(ctx context.Context, dst *layout.PackagePaths, _ bool, _ bool) (v1alpha1.ZarfPackage, []string, error)
LoadPackageMetadata loads package metadata from a cluster.
type OCISource ¶
type OCISource struct { *types.ZarfPackageOptions *zoci.Remote }
OCISource is a package source for OCI registries.
func (*OCISource) Collect ¶
Collect pulls a package from an OCI registry and writes it to a tarball.
func (*OCISource) LoadPackage ¶
func (s *OCISource) LoadPackage(ctx context.Context, dst *layout.PackagePaths, filter filters.ComponentFilterStrategy, unarchiveAll bool) (pkg v1alpha1.ZarfPackage, warnings []string, err error)
LoadPackage loads a package from an OCI registry.
func (*OCISource) LoadPackageMetadata ¶
func (s *OCISource) LoadPackageMetadata(ctx context.Context, dst *layout.PackagePaths, wantSBOM bool, skipValidation bool) (pkg v1alpha1.ZarfPackage, warnings []string, 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(ctx context.Context, dst *layout.PackagePaths, filter filters.ComponentFilterStrategy, unarchiveAll bool) (pkg v1alpha1.ZarfPackage, warnings []string, err error) // LoadPackageMetadata loads a package's metadata from a source. LoadPackageMetadata(ctx context.Context, dst *layout.PackagePaths, wantSBOM bool, skipValidation bool) (pkg v1alpha1.ZarfPackage, warnings []string, err error) // Collect relocates a package from its source to a tarball in a given destination directory. Collect(ctx context.Context, 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 ¶
func New(ctx context.Context, pkgOpts *types.ZarfPackageOptions) (PackageSource, error)
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) LoadPackage ¶
func (s *SplitTarballSource) LoadPackage(ctx context.Context, dst *layout.PackagePaths, filter filters.ComponentFilterStrategy, unarchiveAll bool) (pkg v1alpha1.ZarfPackage, warnings []string, err error)
LoadPackage loads a package from a split tarball.
func (*SplitTarballSource) LoadPackageMetadata ¶
func (s *SplitTarballSource) LoadPackageMetadata(ctx context.Context, dst *layout.PackagePaths, wantSBOM bool, skipValidation bool) (pkg v1alpha1.ZarfPackage, warnings []string, 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) LoadPackage ¶
func (s *TarballSource) LoadPackage(ctx context.Context, dst *layout.PackagePaths, filter filters.ComponentFilterStrategy, unarchiveAll bool) (pkg v1alpha1.ZarfPackage, warnings []string, err error)
LoadPackage loads a package from a tarball.
func (*TarballSource) LoadPackageMetadata ¶
func (s *TarballSource) LoadPackageMetadata(ctx context.Context, dst *layout.PackagePaths, wantSBOM bool, skipValidation bool) (pkg v1alpha1.ZarfPackage, warnings []string, 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) LoadPackage ¶
func (s *URLSource) LoadPackage(ctx context.Context, dst *layout.PackagePaths, filter filters.ComponentFilterStrategy, unarchiveAll bool) (pkg v1alpha1.ZarfPackage, warnings []string, err error)
LoadPackage loads a package from an http, https or sget URL.
func (*URLSource) LoadPackageMetadata ¶
func (s *URLSource) LoadPackageMetadata(ctx context.Context, dst *layout.PackagePaths, wantSBOM bool, skipValidation bool) (pkg v1alpha1.ZarfPackage, warnings []string, err error)
LoadPackageMetadata loads a package's metadata from an http, https or sget URL.