cnabtooci

package
v1.0.0-alpha.13 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2022 License: Apache-2.0 Imports: 18 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrNoContentDigest added in v0.30.0

type ErrNoContentDigest error

ErrNoContentDigest represents an error due to an image not having a corresponding content digest in a bundle definition

func NewErrNoContentDigest added in v0.30.0

func NewErrNoContentDigest(image string) ErrNoContentDigest

NewErrNoContentDigest returns an ErrNoContentDigest formatted with the provided image name

type Registry

type Registry struct {
	*portercontext.Context
}

func NewRegistry

func NewRegistry(c *portercontext.Context) *Registry

func (*Registry) IsImageCached

func (r *Registry) IsImageCached(ctx context.Context, invocationImage string) (bool, error)

func (*Registry) PullBundle

func (r *Registry) PullBundle(ref cnab.OCIReference, insecureRegistry bool) (cnab.BundleReference, error)

PullBundle pulls a bundle from an OCI registry. Returns the bundle, and an optional image relocation mapping, if applicable.

func (*Registry) PushBundle

func (r *Registry) PushBundle(ctx context.Context, bundleRef cnab.BundleReference, insecureRegistry bool) (cnab.BundleReference, error)

func (*Registry) PushInvocationImage

func (r *Registry) PushInvocationImage(ctx context.Context, invocationImage string) (digest.Digest, error)

PushInvocationImage pushes the invocation image from the Docker image cache to the specified location the expected format of the invocationImage is REGISTRY/NAME:TAG. Returns the image digest from the registry.

type RegistryProvider

type RegistryProvider interface {
	// PullBundle pulls a bundle from an OCI registry.
	PullBundle(ref cnab.OCIReference, insecureRegistry bool) (cnab.BundleReference, error)

	// PushBundle pushes a bundle to an OCI registry.
	PushBundle(ctx context.Context, bundleRef cnab.BundleReference, insecureRegistry bool) (cnab.BundleReference, error)

	// PushInvocationImage pushes the invocation image from the Docker image cache to the specified location
	// the expected format of the invocationImage is REGISTRY/NAME:TAG.
	// Returns the image digest from the registry.
	PushInvocationImage(ctx context.Context, invocationImage string) (digest.Digest, error)

	// IsImageCached checks whether a particular invocation image exists in the local image cache.
	IsImageCached(ctx context.Context, invocationImage string) (bool, error)
}

Registry handles talking with an OCI registry.

type TestRegistry

type TestRegistry struct {
	MockPullBundle          func(ref cnab.OCIReference, insecureRegistry bool) (cnab.BundleReference, error)
	MockPushBundle          func(bundleRef cnab.BundleReference, insecureRegistry bool) (bundleReference cnab.BundleReference, err error)
	MockPushInvocationImage func(ctx context.Context, invocationImage string) (imageDigest digest.Digest, err error)
	MockIsImageCached       func(ctx context.Context, invocationImage string) (bool, error)
}

func NewTestRegistry

func NewTestRegistry() *TestRegistry

func (TestRegistry) IsImageCached

func (t TestRegistry) IsImageCached(ctx context.Context, invocationImage string) (bool, error)

func (TestRegistry) PullBundle

func (t TestRegistry) PullBundle(ref cnab.OCIReference, insecureRegistry bool) (cnab.BundleReference, error)

func (TestRegistry) PushBundle

func (t TestRegistry) PushBundle(ctx context.Context, bundleRef cnab.BundleReference, insecureRegistry bool) (cnab.BundleReference, error)

func (TestRegistry) PushInvocationImage

func (t TestRegistry) PushInvocationImage(ctx context.Context, invocationImage string) (digest.Digest, error)

Jump to

Keyboard shortcuts

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