converter

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package cnabtooci provides converters to transform CNAB to OCI format and vice versa.

Index

Constants

View Source
const (
	// CNABVersion is the currently supported CNAB runtime version
	CNABVersion = "v1.0.0"

	// OCIIndexSchemaVersion is the currently supported OCI index schema's version
	OCIIndexSchemaVersion = 2
)
View Source
const (
	// CNABRuntimeVersionAnnotation is the top level annotation specifying the CNAB runtime version
	CNABRuntimeVersionAnnotation = "io.cnab.runtime_version"
	// CNABKeywordsAnnotation is the top level annotation specifying a list of keywords
	CNABKeywordsAnnotation = "io.cnab.keywords"
	// ArtifactTypeAnnotation is the top level annotation specifying the type of the artifact in the registry
	ArtifactTypeAnnotation = "org.opencontainers.artifactType"
	// ArtifactTypeValue is the value of ArtifactTypeAnnotion for CNAB bundles
	ArtifactTypeValue = "application/vnd.cnab.manifest.v1"
)
View Source
const (
	// CNABDescriptorTypeAnnotation is a descriptor-level annotation specifying the type of reference image (currently invocation or component)
	CNABDescriptorTypeAnnotation = "io.cnab.manifest.type"
	// CNABDescriptorTypeInvocation is the CNABDescriptorTypeAnnotation value for invocation images
	CNABDescriptorTypeInvocation cnabDescriptorTypeValue = "invocation"
	// CNABDescriptorTypeComponent is the CNABDescriptorTypeAnnotation value for component images
	CNABDescriptorTypeComponent cnabDescriptorTypeValue = "component"
	// CNABDescriptorTypeConfig is the CNABDescriptorTypeAnnotation value for bundle configuration
	CNABDescriptorTypeConfig cnabDescriptorTypeValue = "config"

	// CNABDescriptorComponentNameAnnotation is a decriptor-level annotation specifying the component name
	CNABDescriptorComponentNameAnnotation = "io.cnab.component.name"
)
View Source
const (
	// CNABConfigMediaType is the config media type of the CNAB config image manifest
	CNABConfigMediaType = "application/vnd.cnab.config.v1+json"
)

Variables

This section is empty.

Functions

func ConvertBundleToOCIIndex

func ConvertBundleToOCIIndex(b *bundle.Bundle, targetRef reference.Named,
	bundleConfigManifestRef ocischemav1.Descriptor, relocationMap relocation.ImageRelocationMap) (*ocischemav1.Index, error)

ConvertBundleToOCIIndex converts a CNAB bundle into an OCI Index representation

func GenerateRelocationMap

func GenerateRelocationMap(ix *ocischemav1.Index, b *bundle.Bundle, originRepo reference.Named) (relocation.ImageRelocationMap, error)

GenerateRelocationMap generates the bundle relocation map

func GetBundleConfigManifestDescriptor

func GetBundleConfigManifestDescriptor(ix *ocischemav1.Index) (ocischemav1.Descriptor, error)

GetBundleConfigManifestDescriptor returns the CNAB runtime config manifest descriptor from a OCI index

Types

type PreparedBundleConfig

type PreparedBundleConfig struct {
	ConfigBlob           []byte
	ConfigBlobDescriptor ocischemav1.Descriptor
	Manifest             []byte
	ManifestDescriptor   ocischemav1.Descriptor
	Fallback             *PreparedBundleConfig
}

PreparedBundleConfig contains the config blob, image manifest (and fallback), and descriptors for a CNAB config

func PrepareForPush

func PrepareForPush(b *bundle.Bundle) (*PreparedBundleConfig, error)

PrepareForPush serializes a bundle config, generates its image manifest, and its manifest descriptor

Jump to

Keyboard shortcuts

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