Documentation
¶
Overview ¶
Package bundle builds nemo bundles from a compose project, and moves them between registries and OCI layout directories.
Index ¶
- Constants
- func Build(ctx context.Context, request BuildRequest) (cnab.ExtendedBundle, error)
- func Copy(ctx context.Context, source, destination Location) (ocispec.Descriptor, error)
- func ImagesOf(definition cnab.ExtendedBundle, relocationMap relocation.ImageRelocationMap, ...) []transfer.Image
- func Pull(ctx context.Context, location Location) (cnab.BundleReference, error)
- func Push(ctx context.Context, built cnab.ExtendedBundle, sources []transfer.Image, ...) (ocispec.Descriptor, error)
- type BuildRequest
- type Location
- type Metadata
- type RegistryTags
Constants ¶
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.
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 ¶
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 ¶
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.
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 ¶
ParseLocation parses docker://REFERENCE or oci:PATH[:REFERENCE].
func (Location) 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 ¶
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.
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)