oci

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

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 HTTPTransport added in v0.2.0

func HTTPTransport() http.RoundTripper

func ImageDescriptor added in v0.3.1

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

func MultiKeychainAll added in v0.1.6

func MultiKeychainAll() authn.Keychain

func MultiKeychainOption added in v0.1.6

func MultiKeychainOption() remote.Option

func ParsePlatform added in v0.1.5

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 added in v0.3.0

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

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

func PushIndexToRegistry added in v0.3.0

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

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

func RefToPURL

func RefToPURL(ref string, platform *v1.Platform) (string, bool, error)

func ReplaceTag added in v0.3.1

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 added in v0.3.0

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

SaveImage saves an image to the specified output.

func SaveImageAsOCILayout added in v0.3.0

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

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

func SaveImagesNoTag added in v0.3.1

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

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

func SaveIndex added in v0.3.0

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

SaveIndex saves an index to the specified outputs.

func SaveIndexAsOCILayout added in v0.3.0

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

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

func SplitDigest added in v0.1.4

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

func WithOptions added in v0.1.5

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

func WithoutTag added in v0.1.5

func WithoutTag(image string) (string, error)

Types

type EmptyConfigImage added in v0.3.1

type EmptyConfigImage struct {
	v1.Image
}

func (*EmptyConfigImage) Digest added in v0.3.1

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

func (*EmptyConfigImage) Manifest added in v0.3.1

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

func (*EmptyConfigImage) RawConfigFile added in v0.3.1

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

func (*EmptyConfigImage) RawManifest added in v0.3.1

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

type ImageDetailsResolver added in v0.1.5

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 added in v0.1.5

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

func ParseImageSpec added in v0.1.5

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

func ParseImageSpecs added in v0.1.5

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

func ReplaceDigestInSpec added in v0.3.0

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

func ReplaceTagInSpec added in v0.1.8

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

func (*ImageSpec) ForPlatforms added in v0.1.5

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

type ImageSpecOption added in v0.1.5

type ImageSpecOption func(*ImageSpec) error

func WithPlatform added in v0.1.5

func WithPlatform(platform string) ImageSpecOption

type NamedIndex added in v0.1.7

type NamedIndex struct {
	Index v1.ImageIndex
	Name  string
}

func IndexFromPath added in v0.1.7

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

func IndexFromRemote added in v0.1.7

func IndexFromRemote(image string) (*NamedIndex, error)

func LoadIndex added in v0.1.7

func LoadIndex(input *ImageSpec) (*NamedIndex, error)

type Option

type Option = func(*http.Client)

type RegistryImageDetailsResolver added in v0.1.5

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

func NewRegistryImageDetailsResolver added in v0.1.5

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

func (*RegistryImageDetailsResolver) ImageDescriptor added in v0.1.8

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

func (*RegistryImageDetailsResolver) ImageName added in v0.1.5

func (*RegistryImageDetailsResolver) ImagePlatform added in v0.1.5

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

type SourceType added in v0.1.5

type SourceType string

Jump to

Keyboard shortcuts

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