Documentation
¶
Overview ¶
Package zoci contains functions for interacting with Zarf packages stored in OCI registries.
Package zoci contains functions for interacting with Zarf packages stored in OCI registries.
Package zoci contains functions for interacting with Zarf packages stored in OCI registries.
Package zoci contains functions for interacting with Zarf packages stored in OCI registries.
Package zoci contains functions for interacting with Zarf packages stored in OCI registries.
Package zoci contains functions for interacting with Zarf packages stored in OCI registries.
Index ¶
- Constants
- Variables
- func AssembleLayers(ctx context.Context, root *oci.Manifest, fetcher content.Fetcher, ...) ([]ocispec.Descriptor, error)
- func CopyPackage(ctx context.Context, src *Remote, dst *Remote, opts PublishOptions) (err error)
- func FetchZarfYAML(ctx context.Context, root *oci.Manifest, fetcher content.Fetcher) (api.Package, error)
- func GetInitPackageURL(version string) string
- func GetOCICacheModifier(cachePath string) (oci.Modifier, error)
- func LayersFromComponents(root *oci.Manifest, pkg api.Package, requestedComponents []api.Component) ([]ocispec.Descriptor, map[string]bool, error)
- func LayersFromImages(ctx context.Context, root *oci.Manifest, fetcher content.Fetcher, ...) ([]ocispec.Descriptor, error)
- func NormalizeOCISource(source string) string
- func PlatformForSkeleton() ocispec.Platform
- func ReferenceFromMetadata(registryLocation string, pkg api.Package) (registry.Reference, error)
- func ReferenceFromMetadataWithOptions(registryLocation string, pkg api.Package, opts ReferenceFromMetadataOptions) (registry.Reference, error)
- func Retry(ctx context.Context, retries int, fn func() error) error
- type AttachmentSelection
- type LayerSelection
- type PublishOptions
- type ReferenceFromMetadataOptions
- type Remote
- func (r *Remote) AssembleLayers(ctx context.Context, selection LayerSelection) ([]ocispec.Descriptor, error)
- func (r *Remote) FetchImagesIndex(ctx context.Context) (*ocispec.Index, error)
- func (r *Remote) FetchZarfYAML(ctx context.Context) (api.Package, error)
- func (r *Remote) LayersFromComponents(ctx context.Context, pkg api.Package, requestedComponents []api.Component) ([]ocispec.Descriptor, map[string]bool, error)
- func (r *Remote) LayersFromImages(ctx context.Context, imageList map[string]bool) ([]ocispec.Descriptor, error)
- func (r *Remote) PullPackage(ctx context.Context, destinationDir string, concurrency int, ...) (_ []ocispec.Descriptor, err error)
- func (r *Remote) PushPackage(ctx context.Context, pkgLayout *layout.PackageLayout, opts PublishOptions) (_ ocispec.Descriptor, err error)
- type RemoteClientOptions
- type SBOMSelection
Constants ¶
const ( // DefaultConcurrency is the default concurrency used for operations. DefaultConcurrency = 6 // DefaultRetries is the default number of retries for operations. DefaultRetries = 1 // ImageCacheDirectory is the directory within the Zarf cache containing OCI blobs. ImageCacheDirectory = "images" )
Variables ¶
var ( // PackageAlwaysPull is a list of paths that will always be pulled from the remote repository. PackageAlwaysPull = []string{layout.ZarfYAML, layout.Checksums, layout.Signature, layout.Bundle, layout.ValuesYAML, layout.ValuesSchema} //nolint:staticcheck // layout.Signature intentionally included for backward-compat with pre-v0.72.0 packages )
Functions ¶
func AssembleLayers ¶ added in v0.83.0
func AssembleLayers(ctx context.Context, root *oci.Manifest, fetcher content.Fetcher, selection LayerSelection) ([]ocispec.Descriptor, error)
AssembleLayers returns the OCI layer descriptors for the requested package resources. Metadata layers are always included.
func CopyPackage ¶
CopyPackage copies a zarf package from one OCI registry to another using ORAS with retry.
func FetchZarfYAML ¶ added in v0.83.0
func FetchZarfYAML(ctx context.Context, root *oci.Manifest, fetcher content.Fetcher) (api.Package, error)
FetchZarfYAML fetches and parses the zarf.yaml layer of an already-fetched root manifest.
func GetInitPackageURL ¶
GetInitPackageURL returns the URL for the init package for the given version.
func GetOCICacheModifier ¶ added in v0.56.0
GetOCICacheModifier takes in a Zarf cachePath and uses it to return an oci.WithCache modifier
func LayersFromComponents ¶ added in v0.83.0
func LayersFromComponents(root *oci.Manifest, pkg api.Package, requestedComponents []api.Component) ([]ocispec.Descriptor, map[string]bool, error)
LayersFromComponents returns the layers for the requested components and the set of images those components reference, selecting from root.
func LayersFromImages ¶ added in v0.83.0
func LayersFromImages(ctx context.Context, root *oci.Manifest, fetcher content.Fetcher, imageList map[string]bool) ([]ocispec.Descriptor, error)
LayersFromImages returns the image blob layers referenced by imageList, selecting from root. fetcher reads image manifests/indexes to walk multi-arch children.
func NormalizeOCISource ¶ added in v0.85.0
NormalizeOCISource adds the OCI scheme to valid registry references.
func PlatformForSkeleton ¶
PlatformForSkeleton sets the target architecture for the remote to skeleton
func ReferenceFromMetadata ¶
ReferenceFromMetadata returns a reference for the given metadata.
func ReferenceFromMetadataWithOptions ¶ added in v0.74.0
func ReferenceFromMetadataWithOptions(registryLocation string, pkg api.Package, opts ReferenceFromMetadataOptions) (registry.Reference, error)
ReferenceFromMetadataWithOptions returns a reference for the given metadata with optional overrides
Types ¶
type AttachmentSelection ¶ added in v0.89.0
type AttachmentSelection struct {
Keys []string
}
AttachmentSelection specifies which declared attachment resources to retrieve. An empty key set selects every declared attachment.
type LayerSelection ¶ added in v0.89.0
type LayerSelection struct {
// RequestedComponents scopes component and image layers.
// A nil slice selects every package component; a non-nil empty slice selects none.
RequestedComponents []api.Component
// IncludeComponents retrieves component archive layers in the requested scope.
IncludeComponents bool
// IncludeImages retrieves image layers referenced by components in the requested scope.
IncludeImages bool
// SBOMs selects SBOM resources; nil skips SBOM layers.
SBOMs *SBOMSelection
// Attachments selects attachment resources; nil skips attachment layers.
Attachments *AttachmentSelection
}
LayerSelection controls optional OCI package layers to retrieve. Metadata layers are always retrieved; a zero-value selection retrieves metadata only.
func AllLayerSelection ¶ added in v0.89.0
func AllLayerSelection() LayerSelection
AllLayerSelection returns a selection for every package resource.
type PublishOptions ¶ added in v0.61.1
type PublishOptions struct {
// Retries is the number of times to retry a failed operation
Retries int
// OCIConcurrency configures the amount of layers to push in parallel
OCIConcurrency int
// Tag allows for overriding the destination reference
Tag string
}
PublishOptions contains options for the publish operation
type ReferenceFromMetadataOptions ¶ added in v0.74.0
type ReferenceFromMetadataOptions struct {
// Tag specifies the OCI reference to use instead of package.metadata.version
Tag string
}
ReferenceFromMetadataOptions provides extensible options
type Remote ¶
type Remote struct {
*oci.OrasRemote
}
Remote is a wrapper around the Oras remote repository with zarf specific functions
func NewRemoteWithOptions ¶ added in v0.84.0
func NewRemoteWithOptions(ctx context.Context, url string, platform ocispec.Platform, options RemoteClientOptions) (*Remote, error)
NewRemoteWithOptions returns an ORAS remote repository configured with Zarf's cache, credential, and transport options.
func (*Remote) AssembleLayers ¶ added in v0.55.0
func (r *Remote) AssembleLayers(ctx context.Context, selection LayerSelection) ([]ocispec.Descriptor, error)
AssembleLayers returns the OCI layer descriptors for the requested package resources.
func (*Remote) FetchImagesIndex ¶
FetchImagesIndex fetches the images/index.json file from the remote repository.
func (*Remote) FetchZarfYAML ¶
FetchZarfYAML fetches the zarf.yaml file from the remote repository.
func (*Remote) LayersFromComponents ¶ added in v0.55.0
func (r *Remote) LayersFromComponents(ctx context.Context, pkg api.Package, requestedComponents []api.Component) ([]ocispec.Descriptor, map[string]bool, error)
LayersFromComponents returns the layers for the requested components and the set of images those components reference, selecting from root.
func (*Remote) LayersFromImages ¶ added in v0.55.0
func (r *Remote) LayersFromImages(ctx context.Context, imageList map[string]bool) ([]ocispec.Descriptor, error)
LayersFromImages returns the layers for the given images to pull from OCI.
func (*Remote) PullPackage ¶
func (r *Remote) PullPackage(ctx context.Context, destinationDir string, concurrency int, layersToPull ...ocispec.Descriptor) (_ []ocispec.Descriptor, err error)
PullPackage pulls the package from the remote repository and saves it to the given path.
func (*Remote) PushPackage ¶ added in v0.56.0
func (r *Remote) PushPackage(ctx context.Context, pkgLayout *layout.PackageLayout, opts PublishOptions) (_ ocispec.Descriptor, err error)
PushPackage publishes the zarf package to the remote repository.
type RemoteClientOptions ¶ added in v0.84.0
type RemoteClientOptions struct {
// CachePath stores OCI layers locally when non-empty.
CachePath string
// CredentialFunc supplies registry credentials.
// If nil, the Docker credential store is used instead.
CredentialFunc auth.CredentialFunc
// Transport configures HTTP transport behavior such as proxies and mTLS.
// It is cloned before use and is never modified.
Transport *http.Transport
types.RemoteOptions
}
RemoteClientOptions configures Zarf's OCI remote client.
type SBOMSelection ¶ added in v0.89.0
type SBOMSelection struct {
Keys []string
}
SBOMSelection specifies which checksum-declared SBOM resources to retrieve. Keys are exact component names or image references. A key selects every matching resource. An empty key set selects every declared SBOM.