coci

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Package coci contains functions for interacting with Cargoship packages stored in OCI registries, derived from github.com/zarf-dev/src/pkg/zoci.

Index

Constants

View Source
const (
	// CargoshipConfigMediaType is the media type for the manifest config
	CargoshipConfigMediaType = "application/vnd.cargoship.config.v1+json"
	// CargoshipLayerMediaTypeBlob is the media type for all Zarf layers due to the range of possible content
	CargoshipLayerMediaTypeBlob = "application/vnd.cargoship.layer.v1.blob"
	// DefaultConcurrency is the default concurrency used for operations
	DefaultConcurrency = 6
	//DefaultRetries is the default number of retries for operations
	DefaultRetries = 1
)
View Source
const OCITimestampFormat = time.RFC3339

OCITimestampFormat is the format used for the OCI timestamp annotation

Variables

View Source
var (
	// PackageAlwaysPull is a list of paths that will always be pulled from the remote repository.
	PackageAlwaysPull = []string{
		config.DistroYAML,
		config.Checksums,
		config.Bundle,
	}
)

Functions

func AssembleLayers

func AssembleLayers(ctx context.Context, root *oci.Manifest, fetcher content.Fetcher, include ...layers.LayerType) ([]ocispec.Descriptor, error)

AssembleLayers returns the OCI layer descriptors for the requested components. The include parameter specifies which layer types to return. All layers are included if include is empty and Metadata layers are always included

func CopyPackage

func CopyPackage(ctx context.Context, src *Remote, dst *Remote, opts PublishOptions) (err error)

CopyPackage copies a zarf package from one OCI registry to another using ORAS with retry.

func FetchDistroYAML

func FetchDistroYAML(ctx context.Context, root *oci.Manifest, fetcher content.Fetcher) (distro.ZarfDistro, error)

FetchDistroYAML fetches the distro.yaml file from the remote repository.

func GetOCICacheModifier

func GetOCICacheModifier(ctx context.Context, cachePath string) (oci.Modifier, error)

GetOCICacheModifier takes in a Cargoship cachePath and uses it to return an oci.WithCache modifier

func LayersFromFiles

func LayersFromFiles(ctx context.Context, root *oci.Manifest, files v1alpha1.ZarfFiles, folder string) ([]ocispec.Descriptor, error)

LayersFromFiles returns the file oci blob layers referenced by annotation.

func LayersFromImages

func LayersFromImages(ctx context.Context, root *oci.Manifest, fetcher content.Fetcher, imageList []string) ([]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 ReferenceFromMetadata

func ReferenceFromMetadata(registryLocation string, pkg distro.ZarfDistro) (registry.Reference, error)

ReferenceFromMetadata returns a reference for the given metadata.

func ReferenceFromMetadataWithOptions

func ReferenceFromMetadataWithOptions(registryLocation string, pkg distro.ZarfDistro, opts ReferenceFromMetadataOptions) (registry.Reference, error)

ReferenceFromMetadataWithOptions returns a reference for the given metadata with optional overrides

Types

type PublishOptions

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

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 cargoship specific functions

func NewRemote

func NewRemote(ctx context.Context, url string, platform ocispec.Platform, mods ...oci.Modifier) (*Remote, error)

NewRemote returns an oras remote repository client and context for the given url with cargoship opination embedded

func (*Remote) AssembleLayers

func (r *Remote) AssembleLayers(ctx context.Context, include ...layers.LayerType) ([]ocispec.Descriptor, error)

AssembleLayers returns the OCI layer descriptors for the requested components. The include parameter specifies which layer types to return. All layers are included if include is empty and Metadata layers are always included

func (*Remote) FetchDistroYAML

func (r *Remote) FetchDistroYAML(ctx context.Context) (distro.ZarfDistro, error)

FetchDistroYAML fetches the distro.yaml file from the remote repository.

func (*Remote) FetchImagesIndex

func (r *Remote) FetchImagesIndex(ctx context.Context) (*ocispec.Index, error)

FetchImagesIndex fetches the images/index.json file from the remote repository.

func (*Remote) PullDistro

func (r *Remote) PullDistro(ctx context.Context, destinationDir string, concurrency int, layersToPull ...ocispec.Descriptor) (_ []ocispec.Descriptor, err error)

PullDistro pulls the package from the remote repository and saves it to the given path.

func (*Remote) PushPackage

func (r *Remote) PushPackage(ctx context.Context, disLayout *layout.DistroLayout, opts PublishOptions) (_ ocispec.Descriptor, err error)

PushPackage publishes the zarf package to the remote repository.

Directories

Path Synopsis
Package layers contains functions for interacting with Cargoship layers stored in OCI registries, derived from github.com/zarf-dev/src/pkg/zoci.
Package layers contains functions for interacting with Cargoship layers stored in OCI registries, derived from github.com/zarf-dev/src/pkg/zoci.

Jump to

Keyboard shortcuts

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