oci

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertPlatformV1ToCtrd

func ConvertPlatformV1ToCtrd(v1Platform *v1.Platform) platforms.Platform

func DescribePlatform

func DescribePlatform(platform platforms.Platform) string

func DescribePlatforms

func DescribePlatforms(plats ...platforms.Platform) string

func FindManifestForPlatform

func FindManifestForPlatform(findFor platforms.Platform, manifests []v1.Descriptor) *v1.Descriptor

func FindManifestForPlatforms

func FindManifestForPlatforms(findFor []platforms.Platform, manifests []v1.Descriptor, logger *slog.Logger) *v1.Descriptor

func IsPartialVersion

func IsPartialVersion(version string) bool

func IsSemver

func IsSemver(version string) bool

func ParseNamedReference

func ParseNamedReference(registry, repository, tag string) (name.Reference, error)

func ParsePartialVersion

func ParsePartialVersion(version string) []string

Parse a version that is not necessarily a valid semver.

func WithLookupEnv

func WithLookupEnv(lookupEnv LookupValue) func(*RemoteImageStore)

func WithPlatforms

func WithPlatforms(v1Platforms ...*v1.Platform) func(*RemoteImageStore)

func WriteImage

func WriteImage(path, refName string, image v1.Image, logger *slog.Logger) (writeErr error)

Types

type AuthLookupKeychain

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

func NewAuthLookupKeychain

func NewAuthLookupKeychain(lookup LookupValue, logger *slog.Logger) *AuthLookupKeychain

func (*AuthLookupKeychain) Resolve

func (ak *AuthLookupKeychain) Resolve(target authn.Resource) (authn.Authenticator, error)

type CachedImageStore

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

CachedImageStore caches complete OCI images (not individual layers), and does so only for fully qualified image references. A fully qualified image reference has either a digest or a tag with major.minor.patch (and optionally release) components. Image refs with only major, major.minor, or `latest` tags are not cached. Note: there is no cache expiration/eviction yet.

func NewCachedImageStore

func NewCachedImageStore(remote ImageStore, storePath string, logger *slog.Logger) *CachedImageStore

func (*CachedImageStore) Fetch

func (cis *CachedImageStore) Fetch(ctx context.Context, ref name.Reference) (string, error)

type Client

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

func NewClient

func NewClient(imageStore ImageStore, versionLookup VersionLookup) *Client

func (*Client) Pull

func (c *Client) Pull(ctx context.Context, ref name.Reference) (string, error)

type DiskLayerWriter

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

func NewDiskLayerWriter

func NewDiskLayerWriter(logger *slog.Logger) *DiskLayerWriter

func (*DiskLayerWriter) Write

func (w *DiskLayerWriter) Write(layers []v1.Layer, outputDir string) error

type ImageStore

type ImageStore interface {
	Fetch(context.Context, name.Reference) (string, error)
}

type LayerWriter

type LayerWriter interface {
	Write(layers []v1.Layer, dir string) error
}

type LookupValue

type LookupValue func(key string) (string, bool)

type OutputValue

type OutputValue struct {
	Name  string `json:"name"`
	Value any    `json:"value"`
}

type Outputs

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

func NewOutputs

func NewOutputs(outputFile string) *Outputs

func (*Outputs) Write

func (o *Outputs) Write(downloadDir string, imgRef name.Reference, stepPath string) error

type RemoteImageStore

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

RemoteImageStore downloads and extract OCI images. The path is composed from the image reference and is rooted at `storePath`. There's no caching or cleanup.

func NewRemoteImageStore

func NewRemoteImageStore(storePath string, logger *slog.Logger, options ...func(*RemoteImageStore)) *RemoteImageStore

func (*RemoteImageStore) Fetch

func (ris *RemoteImageStore) Fetch(ctx context.Context, ref name.Reference) (string, error)

func (*RemoteImageStore) Version

func (ris *RemoteImageStore) Version(ctx context.Context, ref name.Reference) (*Version, error)

type Version

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

func NewVersion

func NewVersion(major, minor, patch uint64, release string) *Version

func ParseSemanticVersion

func ParseSemanticVersion(version string) (*Version, error)

func (*Version) IsReleaseCandidate

func (v *Version) IsReleaseCandidate() bool

func (*Version) Satisfies

func (v *Version) Satisfies(partialVersion string) bool

Satisfies tests whether the Version satisfies a partial version. The Version satisfies a partial version when every version part in the partial version is equal to the same version part in the Version, including release. This handles the case where a partial image version 1.2.3 is requested, but the annotated Version in the pulled image is e.g 4.5.6. This condition is undefined so we should fail. partialVersion must be a partial version, not e.g. "latest" or a digest.

func (*Version) String

func (v *Version) String() string

func (*Version) TagsToUpdate

func (v *Version) TagsToUpdate(existing Versions) []string

type VersionLookup

type VersionLookup interface {
	Version(context.Context, name.Reference) (*Version, error)
}

type Versions

type Versions []*Version

Jump to

Keyboard shortcuts

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