cnabtooci

package
v1.0.0-beta.4 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2022 License: Apache-2.0 Imports: 21 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetInsecureRegistryTransport added in v1.0.1

func GetInsecureRegistryTransport() *http.Transport

GetInsecureRegistryTransport returns a copy of the default http transport with InsecureSkipVerify set so that we can use it with insecure registries.

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, ref cnab.OCIReference) (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, ref cnab.OCIReference, opts RegistryOptions) ([]string, error)

func (*Registry) PullBundle

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, ref cnab.OCIReference, opts RegistryOptions) error

PullImage pulls an image from an OCI registry.

func (*Registry) PushBundle

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

func (*Registry) PushImage added in v1.0.1

func (r *Registry) PushImage(ctx context.Context, ref cnab.OCIReference, opts RegistryOptions) (digest.Digest, error)

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

type RegistryOptions added in v1.0.1

type RegistryOptions struct {
	// InsecureRegistry allows connecting to an unsecured registry or one without verifiable certificates.
	InsecureRegistry bool
}

RegistryOptions is the set of options for interacting with an OCI registry.

type RegistryProvider

type RegistryProvider interface {
	// PullBundle pulls a bundle from an OCI registry.
	PullBundle(ctx context.Context, ref cnab.OCIReference, opts RegistryOptions) (cnab.BundleReference, error)

	// PushBundle pushes a bundle to an OCI registry.
	PushBundle(ctx context.Context, ref cnab.BundleReference, opts RegistryOptions) (cnab.BundleReference, error)

	// PushImage pushes the image from the Docker image cache to the specified location
	// the expected format of the image is REGISTRY/NAME:TAG.
	// Returns the image digest from the registry.
	PushImage(ctx context.Context, ref cnab.OCIReference, opts RegistryOptions) (digest.Digest, error)

	// GetCachedImage returns a particular image from the local image cache.
	GetCachedImage(ctx context.Context, ref cnab.OCIReference) (ImageSummary, error)

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

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

RegistryProvider handles talking with an OCI registry.

type TestRegistry

type TestRegistry struct {
	MockPullBundle     func(ctx context.Context, ref cnab.OCIReference, opts RegistryOptions) (cnab.BundleReference, error)
	MockPushBundle     func(ctx context.Context, ref cnab.BundleReference, opts RegistryOptions) (bundleReference cnab.BundleReference, err error)
	MockPushImage      func(ctx context.Context, ref cnab.OCIReference, opts RegistryOptions) (imageDigest digest.Digest, err error)
	MockGetCachedImage func(ctx context.Context, ref cnab.OCIReference) (ImageSummary, error)
	MockListTags       func(ctx context.Context, ref cnab.OCIReference, opts RegistryOptions) ([]string, error)
	MockPullImage      func(ctx context.Context, ref cnab.OCIReference, opts RegistryOptions) error
	// contains filtered or unexported fields
}

func NewTestRegistry

func NewTestRegistry() *TestRegistry

func (*TestRegistry) GetCachedImage added in v1.0.1

func (t *TestRegistry) GetCachedImage(ctx context.Context, ref cnab.OCIReference) (ImageSummary, error)

func (*TestRegistry) ListTags added in v1.0.1

func (t *TestRegistry) ListTags(ctx context.Context, ref cnab.OCIReference, opts RegistryOptions) ([]string, error)

func (TestRegistry) PullBundle

func (*TestRegistry) PullImage added in v1.0.1

func (t *TestRegistry) PullImage(ctx context.Context, ref cnab.OCIReference, opts RegistryOptions) error

func (*TestRegistry) PushBundle

func (*TestRegistry) PushImage added in v1.0.1

func (t *TestRegistry) PushImage(ctx context.Context, ref cnab.OCIReference, opts RegistryOptions) (digest.Digest, error)

Jump to

Keyboard shortcuts

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