cnabtooci

package
v1.0.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2022 License: Apache-2.0 Imports: 19 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 ImageSummary added in v1.0.1

type ImageSummary struct {
	types.ImageInspect
	// contains filtered or unexported fields
}

ImageSummary contains information about an OCI image.

func NewImageSummary added in v1.0.1

func NewImageSummary(imageRef string, sum types.ImageInspect) (ImageSummary, error)

func (ImageSummary) Digest added in v1.0.1

func (i ImageSummary) Digest() (digest.Digest, error)

Digest returns the image digest for the image reference.

func (ImageSummary) GetImageReference added in v1.0.1

func (i ImageSummary) GetImageReference() cnab.OCIReference

func (ImageSummary) IsZero added in v1.0.1

func (i ImageSummary) IsZero() bool

type Registry

type Registry struct {
	*portercontext.Context
}

func NewRegistry

func NewRegistry(c *portercontext.Context) *Registry

func (*Registry) GetCachedImage added in v1.0.1

func (r *Registry) GetCachedImage(ctx context.Context, image string) (ImageSummary, error)

GetCachedImage returns information about an image from local docker cache.

func (*Registry) ListTags added in v1.0.1

func (r *Registry) ListTags(ctx context.Context, repository string) ([]string, error)

func (*Registry) PullBundle

func (r *Registry) PullBundle(ctx context.Context, 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) PullImage added in v1.0.1

func (r *Registry) PullImage(ctx context.Context, imgRef string) error

PullImage pulls an image from an OCI registry.

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(ctx context.Context, 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)

	// GetCachedImage returns an particular image from the local image cache.
	GetCachedImage(ctx context.Context, invocationImage string) (ImageSummary, error)

	// ListTags returns all tags defined on the specified repository.
	ListTags(ctx context.Context, repository string) ([]string, error)

	// PullImage pulls a image from an OCI registry and returns the image's digest
	PullImage(ctx context.Context, image string) error
}

RegistryProvider 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)
	MockGetCachedImage      func(ctx context.Context, invocationImage string) (ImageSummary, error)
	MockListTags            func(ctx context.Context, repository string) ([]string, error)
	MockPullImage           func(ctx context.Context, image string) error
}

func NewTestRegistry

func NewTestRegistry() *TestRegistry

func (*TestRegistry) GetCachedImage added in v1.0.1

func (t *TestRegistry) GetCachedImage(ctx context.Context, img string) (ImageSummary, error)

func (*TestRegistry) ListTags added in v1.0.1

func (t *TestRegistry) ListTags(ctx context.Context, repository string) ([]string, error)

func (TestRegistry) PullBundle

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

func (*TestRegistry) PullImage added in v1.0.1

func (t *TestRegistry) PullImage(ctx context.Context, image string) 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