Documentation
¶
Overview ¶
Package layout is used to defining the distro package files
Index ¶
- Constants
- Variables
- func AnnotationsFromMetadata(metadata distro.ZarfDistroMetadata) map[string]string
- type ClusterPath
- type Distro
- type DistroLayout
- func (d *DistroLayout) Archive(ctx context.Context, dirPath string, _ int) (string, error)
- func (d *DistroLayout) Cleanup() error
- func (d *DistroLayout) Digest() string
- func (d *DistroLayout) DirPath() string
- func (d *DistroLayout) Exists(_ context.Context, target ocispec.Descriptor) (bool, error)
- func (d *DistroLayout) Fetch(_ context.Context, target ocispec.Descriptor) (io.ReadCloser, error)
- func (d *DistroLayout) FileName() (string, error)
- func (d *DistroLayout) Files() (map[string]string, error)
- func (d *DistroLayout) GetImageDirPath() string
- func (d *DistroLayout) IsPushable() bool
- func (d *DistroLayout) IsSigned() bool
- func (d *DistroLayout) Resolve(_ context.Context, reference string) (ocispec.Descriptor, error)
- func (d *DistroLayout) SetRegistryDigest(digest string)
- func (d *DistroLayout) SignPackage(ctx context.Context, opts signing.SignBlobOptions) (err error)
- func (d *DistroLayout) TotalSize() int64
- func (d *DistroLayout) VerifyPackageSignature(ctx context.Context, opts signing.VerifyBlobOptions) error
- type DistroLayoutOptions
- type DistroPath
- type VerificationStrategy
Constants ¶
const ( // CargoshipLayerMediaTypeBlob is the media type for all Cargoship package layer blobs. CargoshipLayerMediaTypeBlob = "application/vnd.cargoship.layer.v1.blob" // CargoshipConfigMediaType is the media type for the Cargoship package manifest config. CargoshipConfigMediaType = "application/vnd.cargoship.config.v1+json" // OCITimestampFormat is the format used for the OCI timestamp annotation OCITimestampFormat = time.RFC3339 )
Variables ¶
var ErrNoVerificationMaterial = errors.New("no verification material available")
ErrNoVerificationMaterial is returned when there is nothing to verify against. VerifyIfPossible tolerates this; all other verification errors are always fatal.
Functions ¶
func AnnotationsFromMetadata ¶ added in v0.9.0
func AnnotationsFromMetadata(metadata distro.ZarfDistroMetadata) map[string]string
AnnotationsFromMetadata extracts OCI manifest annotations from Zarf package metadata.
Types ¶
type ClusterPath ¶
ClusterPath object that contains the manifest file and base directory
func ResolveClusterPath ¶
func ResolveClusterPath(path string) (ClusterPath, error)
ResolveClusterPath returns an object of ClusterPath from a given path
type DistroLayout ¶
type DistroLayout struct {
Distro distro.ZarfDistro
// contains filtered or unexported fields
}
DistroLayout struct
func LoadFromDir ¶
func LoadFromDir(ctx context.Context, dirPath string, opts DistroLayoutOptions) (*DistroLayout, error)
LoadFromDir loads and validates a package from the given directory path.
func LoadFromTar ¶
func LoadFromTar(ctx context.Context, tarPath string, opts DistroLayoutOptions) (*DistroLayout, error)
LoadFromTar unpacks the given archive (any compress/format) and loads it.
func NewDistroLayout ¶
func NewDistroLayout(dir string, distro v1alpha1.ZarfDistro) *DistroLayout
NewDistroLayout returns an DistroLayout object
func (*DistroLayout) Archive ¶
Archive creates a tarball from the package layout and returns the path to that tarball
func (*DistroLayout) Cleanup ¶
func (d *DistroLayout) Cleanup() error
Cleanup removes any temporary directories created.
func (*DistroLayout) Digest ¶ added in v0.9.0
func (d *DistroLayout) Digest() string
Digest returns the OCI manifest digest for this package layout.
func (*DistroLayout) Exists ¶ added in v0.9.0
func (d *DistroLayout) Exists(_ context.Context, target ocispec.Descriptor) (bool, error)
Exists implements oras.ReadOnlyTarget.
func (*DistroLayout) Fetch ¶ added in v0.9.0
func (d *DistroLayout) Fetch(_ context.Context, target ocispec.Descriptor) (io.ReadCloser, error)
Fetch implements oras.ReadOnlyTarget. It serves the manifest, config, or a layer blob identified by the descriptor's digest.
func (*DistroLayout) FileName ¶
func (d *DistroLayout) FileName() (string, error)
FileName returns the name of the Zarf package should have when exported to the file system
func (*DistroLayout) Files ¶ added in v0.9.0
func (d *DistroLayout) Files() (map[string]string, error)
Files returns a map of all the files in the package.
func (*DistroLayout) GetImageDirPath ¶
func (d *DistroLayout) GetImageDirPath() string
GetImageDirPath returns the path to where the image tar balls should be stored in
func (*DistroLayout) IsPushable ¶ added in v0.9.0
func (d *DistroLayout) IsPushable() bool
IsPushable reports whether this layout has a computed manifest cache and can be used as a push source. A layout with only a registry digest (e.g. from a partial OCI pull via SetRegistryDigest) returns false because the cache is nil.
func (*DistroLayout) IsSigned ¶ added in v0.9.0
func (d *DistroLayout) IsSigned() bool
IsSigned returns true if the package is signed. It first checks the package metadata (Build.Signed), then falls back to checking for the presence of a signature file for backward compatibility.
func (*DistroLayout) Resolve ¶ added in v0.9.0
func (d *DistroLayout) Resolve(_ context.Context, reference string) (ocispec.Descriptor, error)
Resolve implements oras.ReadOnlyTarget. It accepts the manifest digest or the package name as a reference.
func (*DistroLayout) SetRegistryDigest ¶ added in v0.9.0
func (d *DistroLayout) SetRegistryDigest(digest string)
SetRegistryDigest records the manifest digest as resolved from a registry. It replaces the locally-computed digest and clears the manifest cache, since the registry manifest may differ (e.g. partial OCI pulls). After this call the layout is no longer usable as an oras.ReadOnlyTarget for pushing.
func (*DistroLayout) SignPackage ¶ added in v0.9.0
func (d *DistroLayout) SignPackage(ctx context.Context, opts signing.SignBlobOptions) (err error)
SignPackage signs the zarf package using cosign with the provided options. If the options do not indicate signing should be performed (no key material configured), this is a no-op and returns nil.
func (*DistroLayout) TotalSize ¶ added in v0.9.0
func (d *DistroLayout) TotalSize() int64
TotalSize returns the total bytes that would be pushed for this package (all layers + config + manifest). Returns 0 if the manifest has not been computed.
func (*DistroLayout) VerifyPackageSignature ¶ added in v0.9.0
func (d *DistroLayout) VerifyPackageSignature(ctx context.Context, opts signing.VerifyBlobOptions) error
VerifyPackageSignature verifies the package signature
type DistroLayoutOptions ¶
type DistroLayoutOptions struct {
VerifyBlobOptions *signing.VerifyBlobOptions
// VerificationStrategy specifies whether verification is enforced
VerificationStrategy VerificationStrategy
}
DistroLayoutOptions struct
type DistroPath ¶
DistroPath object that contains the manifest file and base directory
func ResolveDistroPath ¶
func ResolveDistroPath(path string) (DistroPath, error)
ResolveDistroPath returns an object of DistroPath from a given path
type VerificationStrategy ¶ added in v0.9.0
type VerificationStrategy int
VerificationStrategy describes a strategy for determining whether to verify a package.
const ( // VerifyIfPossible will attempt a verification, it will not error if verification // data is missing. But it will not stop processing if verification fails. VerifyIfPossible VerificationStrategy = iota // VerifyAlways will always attempt a verification, and will fail if the // verification fails. VerifyAlways // VerifyNever will skip all verification of a package. VerifyNever )