oci

package
v0.6.8 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: Apache-2.0 Imports: 22 Imported by: 2

README

oci

This package is for generic OCI components. For attestation specific components see the attestation package.

Documentation

Index

Constants

View Source
const (
	OCIReferenceTarget            = "org.opencontainers.image.ref.name"
	LocalPrefix                   = "oci://"
	RegistryPrefix                = "docker://"
	OCI                SourceType = "OCI"
	Docker             SourceType = "Docker"
)

Variables

This section is empty.

Functions

func ImageDescriptor

func ImageDescriptor(ix *v1.IndexManifest, platform *v1.Platform) (*v1.Descriptor, error)

func MultiKeychainAll

func MultiKeychainAll() authn.Keychain

func MultiKeychainOption

func MultiKeychainOption() remote.Option

func ParsePlatform

func ParsePlatform(platformStr string) (*v1.Platform, error)

ParsePlatform parses the provided platform string or attempts to obtain the platform of the current host system.

func PushImageToRegistry

func PushImageToRegistry(ctx context.Context, image v1.Image, imageName string) error

PushImageToRegistry pushes an image to the registry with the specified name.

func PushIndexToRegistry

func PushIndexToRegistry(ctx context.Context, index v1.ImageIndex, imageName string) error

PushIndexToRegistry pushes an index to the registry with the specified name.

func RefToPURL

func RefToPURL(named reference.Named, platform *v1.Platform) (string, bool, error)

func ReplaceTag

func ReplaceTag(image string, digest v1.Hash) (string, error)

so that the index tag is replaced with a tag unique to the image digest and doesn't overwrite it.

func SaveImage

func SaveImage(ctx context.Context, output *ImageSpec, image v1.Image, imageName string) error

SaveImage saves an image to the specified output.

func SaveImageAsOCILayout

func SaveImageAsOCILayout(image v1.Image, path string) error

SaveIndexAsOCILayout saves an image as an OCI layout to the specified path.

func SaveImagesNoTag

func SaveImagesNoTag(ctx context.Context, images []v1.Image, outputs []*ImageSpec) error

SaveImagesNoTag saves a list of images by digest to the specified outputs.

func SaveIndex

func SaveIndex(ctx context.Context, outputs []*ImageSpec, index v1.ImageIndex, indexName string) error

SaveIndex saves an index to the specified outputs.

func SaveIndexAsOCILayout

func SaveIndexAsOCILayout(image v1.ImageIndex, path string) error

SaveIndexAsOCILayout saves an index as an OCI layout to the specified path.

func SplitDigest

func SplitDigest(digest string) (common.DigestSet, error)

func WithOptions

func WithOptions(ctx context.Context, platform *v1.Platform) []remote.Option

func WithoutTag

func WithoutTag(image string) (string, error)

Types

type EmptyConfigImage

type EmptyConfigImage struct {
	v1.Image
}

func (*EmptyConfigImage) Digest

func (i *EmptyConfigImage) Digest() (v1.Hash, error)

func (*EmptyConfigImage) Manifest

func (i *EmptyConfigImage) Manifest() (*v1.Manifest, error)

func (*EmptyConfigImage) RawConfigFile

func (i *EmptyConfigImage) RawConfigFile() ([]byte, error)

func (*EmptyConfigImage) RawManifest

func (i *EmptyConfigImage) RawManifest() ([]byte, error)

type ImageDetailsResolver

type ImageDetailsResolver interface {
	ImageName(ctx context.Context) (string, error)
	ImagePlatform(ctx context.Context) (*v1.Platform, error)
	ImageDescriptor(ctx context.Context) (*v1.Descriptor, error)
}

type ImageSpec

type ImageSpec struct {
	// OCI or Docker
	Type SourceType
	// without oci:// or docker:// (name or path)
	Identifier string
	Platform   *v1.Platform
}

func ParseImageSpec

func ParseImageSpec(img string, options ...ImageSpecOption) (*ImageSpec, error)

func ParseImageSpecs

func ParseImageSpecs(img string) ([]*ImageSpec, error)

func ReplaceDigestInSpec

func ReplaceDigestInSpec(src *ImageSpec, digest v1.Hash) (*ImageSpec, error)

func ReplaceTagInSpec

func ReplaceTagInSpec(src *ImageSpec, digest v1.Hash) (*ImageSpec, error)

func (*ImageSpec) ForPlatforms

func (i *ImageSpec) ForPlatforms(platform string) ([]*ImageSpec, error)

type ImageSpecOption

type ImageSpecOption func(*ImageSpec) error

func WithPlatform

func WithPlatform(platform string) ImageSpecOption

type NamedIndex

type NamedIndex struct {
	Index v1.ImageIndex
	Name  string
}

func IndexFromPath

func IndexFromPath(path string) (*NamedIndex, error)

func IndexFromRemote

func IndexFromRemote(ctx context.Context, image string) (*NamedIndex, error)

func LoadIndex

func LoadIndex(ctx context.Context, input *ImageSpec) (*NamedIndex, error)

type RegistryImageDetailsResolver

type RegistryImageDetailsResolver struct {
	*ImageSpec
	// contains filtered or unexported fields
}

func NewRegistryImageDetailsResolver

func NewRegistryImageDetailsResolver(src *ImageSpec) (*RegistryImageDetailsResolver, error)

func (*RegistryImageDetailsResolver) ImageDescriptor

func (r *RegistryImageDetailsResolver) ImageDescriptor(ctx context.Context) (*v1.Descriptor, error)

func (*RegistryImageDetailsResolver) ImageName

func (*RegistryImageDetailsResolver) ImagePlatform

func (r *RegistryImageDetailsResolver) ImagePlatform(_ context.Context) (*v1.Platform, error)

type SourceType

type SourceType string

Jump to

Keyboard shortcuts

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