oci

package
v0.0.0-...-cab28d8 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrArtifactNotFound indicates that the requested artifact was not found
	// in the registry.
	ErrArtifactNotFound = errors.New("artifact not found")

	// ErrLayerNotFound indicates that the requested layer was not found in the
	// OCI artifact provided.
	ErrLayerNotFound = errors.New("layer not found")

	// Cosign represents the cosign signature kind.
	Cosign = "cosign"
)

Functions

func PrepareRemoteOptions

func PrepareRemoteOptions(
	ctx context.Context,
	cfg *viper.Viper,
	ref name.Reference,
	username,
	password string,
) []remote.Option

prepareRemoteOptions prepares some options used to interact with a remote registry.

Types

type Puller

type Puller struct {
	// contains filtered or unexported fields
}

Puller is a hub.OCIPuller implementation.

func NewPuller

func NewPuller(cfg *viper.Viper) *Puller

NewPuller creates a new Puller instance.

func (*Puller) PullLayer

func (p *Puller) PullLayer(
	ctx context.Context,
	imageRef,
	mediaType,
	username,
	password string,
) (ocispec.Descriptor, []byte, error)

PullLayer pulls the first layer of the media type provided from the OCI artifact at the given reference.

type PullerMock

type PullerMock struct {
	mock.Mock
}

PullerMock is a mock hub.OCIPuller implementation.

func (*PullerMock) PullLayer

func (m *PullerMock) PullLayer(
	ctx context.Context,
	ref,
	mediaType,
	username,
	password string,
) (ocispec.Descriptor, []byte, error)

PullLayer implements the hub.OCIPuller interface.

type SignatureChecker

type SignatureChecker struct {
	// contains filtered or unexported fields
}

SignatureChecker is a hub.OCISignatureChecker implementation.

func NewSignatureChecker

func NewSignatureChecker(cfg *viper.Viper, op hub.OCIPuller) *SignatureChecker

NewSignatureChecker creates a new Puller instance.

func (*SignatureChecker) HasCosignSignature

func (c *SignatureChecker) HasCosignSignature(
	ctx context.Context,
	ref,
	username,
	password string,
) (bool, error)

HasCosignSignature checks if the OCI artifact identified by the reference provided has a cosign (sigstore) signature.

type SignatureCheckerMock

type SignatureCheckerMock struct {
	mock.Mock
}

SignatureCheckerMock is a mock implementation of the hub.OCISignatureChecker interface.

func (*SignatureCheckerMock) HasCosignSignature

func (m *SignatureCheckerMock) HasCosignSignature(
	ctx context.Context,
	ref,
	username,
	password string,
) (bool, error)

HasCosignSignature implements the OCITagsGetter interface.

type TagsGetter

type TagsGetter struct {
	// contains filtered or unexported fields
}

TagsGetter provides a mechanism to get all the version tags available for a given repository in a OCI registry. Tags that aren't valid semver versions will be filtered out.

func NewTagsGetter

func NewTagsGetter(cfg *viper.Viper) *TagsGetter

TagsGetter creates a new TagsGetter instance.

func (*TagsGetter) Tags

func (tg *TagsGetter) Tags(ctx context.Context, r *hub.Repository, onlySemver bool) ([]string, error)

Tags returns a list with the tags available for the provided repository.

type TagsGetterMock

type TagsGetterMock struct {
	mock.Mock
}

TagsGetterMock is a mock implementation of the hub.OCITagsGetter interface.

func (*TagsGetterMock) Tags

func (m *TagsGetterMock) Tags(ctx context.Context, r *hub.Repository, onlySemver bool) ([]string, error)

Tags implements the OCITagsGetter interface.

Jump to

Keyboard shortcuts

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