pack

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2025 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package pack provides functionality for creating and managing OCI artifacts based on resources and blobs. It supports packing resources into OCI-compliant artifacts and pushing them to OCI registries.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArtifactBlob

func ArtifactBlob(ctx context.Context, storage content.Storage, b *ociblob.ArtifactBlob, opts Options) (desc ociImageSpecV1.Descriptor, err error)

ArtifactBlob packs a ociblob.ArtifactBlob into an OCI Storage

func Blob

func Blob(ctx context.Context, storage content.Pusher, b blob.ReadOnlyBlob, desc ociImageSpecV1.Descriptor) (err error)

Blob handles the actual transfer of blob data to the OCI storage. It reads the blob content and pushes it to the storage using the provided descriptor. The function ensures proper cleanup of resources by closing the blob reader after the transfer.

func PrepareArtifactBlobForOCI added in v0.0.5

PrepareArtifactBlobForOCI creates a new OCI layer descriptor for a OCILayerConvertableBlob. It ensures that the involved ArtifactBlob has the size and the digest set, so it can be uploaded to OCI registries, which need these fields for API interactions. If the incoming ArtifactBlob does not have a size or a digest, a new instance of ArtifactBlob having both fields set is created and returned. Otherwise, the initial ArtifactBlob is returned.

func ResourceLocalBlob

func ResourceLocalBlob(ctx context.Context, storage content.Storage, b *ociblob.ArtifactBlob, access *v2.LocalBlob, opts Options) (desc ociImageSpecV1.Descriptor, err error)

func ResourceLocalBlobOCILayer

func ResourceLocalBlobOCILayer(ctx context.Context, storage content.Storage, b *ociblob.ArtifactBlob, access *v2.LocalBlob, opts Options) (ociImageSpecV1.Descriptor, error)

func ResourceLocalBlobOCILayout

func ResourceLocalBlobOCILayout(ctx context.Context, storage content.Storage, b *ociblob.ArtifactBlob, opts Options) (ociImageSpecV1.Descriptor, error)

Types

type OCILayerConvertableBlob

type OCILayerConvertableBlob interface {
	blob.SizeAware
	blob.MediaTypeAware
	blob.DigestAware
}

type Options

type Options struct {
	// AccessScheme is the scheme used for converting resource access types.
	AccessScheme *runtime.Scheme

	// CopyGraphOptions are the options for copying resource graphs when dealing with OCI layouts.
	CopyGraphOptions oras.CopyGraphOptions

	// BaseReference is the base reference for the resource access that is used to update the resource.
	BaseReference string

	// ManifestAnnotations are annotations that will be added to single layer Artifacts
	// They are not used for OCI Layouts.
	ManifestAnnotations map[string]string

	// EnforceGlobalAccess indicates if new resources should contain a global access regardless whether the
	// access is guaranteed to be valid or not
	EnforceGlobalAccess bool
}

Options defines the configuration options for packing a single-layer OCI artifact.

type ResourceBlobOCILayerOptions

type ResourceBlobOCILayerOptions struct {
	// BlobMediaType specifies the media type of the blob, if not specified blob.MediaTypeAware interface will be used
	BlobMediaType string
	// BlobDigest is the digest of the blob, if not specified blob.DigestAware interface will be used
	BlobDigest digest.Digest
	// BlobLayerAnnotations contains additional annotations for the layer
	BlobLayerAnnotations map[string]string
}

ResourceBlobOCILayerOptions defines the configuration options for pushing a blob as a resource.

Jump to

Keyboard shortcuts

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