Help us shape the future of Go! Take the 2026 Go Developer Survey

bundle

package
v0.3.1 Latest Latest
Warning

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

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

Documentation

Overview

Package bundle builds nemo bundles from a compose project, and moves them between registries and OCI layout directories.

Index

Constants

View Source
const (
	// Registry is docker://REFERENCE, a reference in a registry.
	Registry = "docker"
	// Layout is oci:PATH[:REFERENCE], an OCI image layout directory.
	Layout = "oci"
)

Transports of a location.

View Source
const Extension = "x-nemo-bundle"

Extension is the block of a bundle's compose that describes the bundle, as x-sntns-bundle did.

Variables

This section is empty.

Functions

func Build

func Build(ctx context.Context, request BuildRequest) (cnab.ExtendedBundle, error)

Build returns the bundle of the compose files: their metadata, a parameter per variable, a credential per secret read from a variable, the images with their digest, the nemo-* parameters, and the compose project itself in io.nemo.compose.

func Copy

func Copy(ctx context.Context, source, destination Location) (ocispec.Descriptor, error)

Copy copies the bundle at source and its images to destination, as porter copy does: from an OCI layout to a registry, for one. The bundle is tagged with its version unless destination names a tag.

func ImagesOf

func ImagesOf(definition cnab.ExtendedBundle, relocationMap relocation.ImageRelocationMap, source string) []transfer.Image

ImagesOf returns the images of the bundle, its invocation image's included, with where to read them: in the OCI layout the bundle was pulled from, else in a registry, where they were relocated or where the bundle names them. source is where the bundle came from: a bundle.json, or a location.

func Pull

func Pull(ctx context.Context, location Location) (cnab.BundleReference, error)

Pull reads the bundle at the location. From a registry, its relocation map says where its images are; a layout's images are on no registry, so it has none.

func Push

func Push(ctx context.Context, built cnab.ExtendedBundle, sources []transfer.Image, destination Location) (ocispec.Descriptor, error)

Push writes the bundle and its images to destination, the way cnab-to-oci puts a bundle in a registry, which Porter reads: each image copied into the bundle's repository by its digest, then the bundle, as an index of them tagged with the bundle's version unless destination names a tag. sources are the images of the bundle, the invocation image's included, read where they are.

Types

type BuildRequest

type BuildRequest struct {
	// ComposeFiles are merged in order; one of them has x-nemo-bundle.
	ComposeFiles []string
	// Version overrides the version of x-nemo-bundle.
	Version string
	// Images maps each image name of the compose to the location it is
	// built at: docker://REFERENCE or oci:PATH[:REFERENCE].
	Images map[string]string
	// Installer is the invocation image: a location, docker://REFERENCE or
	// oci:PATH, to carry it with the bundle, or the name of an image the
	// target has.
	Installer string
}

BuildRequest builds a bundle from compose files.

func (BuildRequest) Sources

func (request BuildRequest) Sources() ([]transfer.Image, error)

Sources returns the images of the bundle read where they are built, by the name the bundle gives them, the installer's included when it is a location.

type Location

type Location struct {
	Transport string
	// Reference is the registry reference, or the reference name in the
	// layout, empty when the layout holds a single manifest.
	Reference string
	// Path is the layout directory.
	Path string
}

Location is where an image or a bundle is: in a registry, or in an OCI image layout directory, as the sntns pipeline builds them.

func ParseLocation

func ParseLocation(text string) (Location, error)

ParseLocation parses docker://REFERENCE or oci:PATH[:REFERENCE].

func (Location) Image

func (location Location) Image(name string) transfer.Image

Image is the image of the location, as the bundle names it: read where the location is, its digest is the one found there.

func (Location) ImageName

func (location Location) ImageName() string

ImageName is the name the image of the location runs as, when nothing relocates it: its reference, or a layout's directory name tagged with its reference, latest when it has none.

func (Location) Resolve

func (location Location) Resolve(ctx context.Context) (ocispec.Descriptor, error)

Resolve returns the descriptor of the manifest, or of the index, the location names.

func (Location) String

func (location Location) String() string

type Metadata

type Metadata struct {
	Name        string              `json:"name"`
	Version     string              `json:"version,omitempty"`
	Description string              `json:"description,omitempty"`
	License     string              `json:"license,omitempty"`
	Keywords    []string            `json:"keywords,omitempty"`
	Maintainers []bundle.Maintainer `json:"maintainers,omitempty"`
	// Dependencies are the bundles this one needs, as io.cnab.dependencies
	// declares them: each a REGISTRY/NAME reference with version ranges.
	Dependencies *cnab.Dependencies `json:"dependencies,omitempty"`
}

Metadata is the content of x-nemo-bundle.

type RegistryTags

type RegistryTags struct{}

RegistryTags lists the tags of a repository in its registry, with the credentials of docker login: what cnab.Resolver picks a dependency's version among.

func (RegistryTags) ListTags

func (RegistryTags) ListTags(ctx context.Context, repository cnab.OCIReference) ([]string, error)

Jump to

Keyboard shortcuts

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