oci

package
v1.235.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 57 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package oci provides shared helpers for authenticating to OCI registries.

Package oci is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidFilePath = errors.New("invalid file path")
View Source
var ErrNoLayers = errors.New("the OCI image does not have any layers")

Functions

func Copy

func Copy(ctx context.Context, src Source, dst Destination, options ...CopyOption) (ocispec.Descriptor, error)

Copy transfers the graph below the source reference (a manifest, image, or index with every child) into the destination under its reference (the source reference when empty). Raw manifest and index bytes are streamed unchanged and every node is digest-verified by the receiving store, so identity survives registry, layout, and registry hops. Cancelling ctx stops traversal.

If a write fails with an unknown outcome the destination is resolved before deciding: when the destination reference already addresses the source root the copy is complete. There are no blind mutation retries, and rejected credentials are never retried anonymously.

func Descriptor

func Descriptor(mediaType string, raw []byte) ocispec.Descriptor

Descriptor builds a descriptor for raw bytes.

func ExportIndex

func ExportIndex(ctx context.Context, source Registry, ref name.Reference, directory string) error

ExportIndex downloads all platforms into an offline OCI layout.

func ExtendedCopy

func ExtendedCopy(ctx context.Context, src GraphSource, dst Destination, options ...CopyOption) (ocispec.Descriptor, error)

ExtendedCopy is Copy plus every predecessor of the graph (signatures, SBOMs, and other referrers), discovered through the source's referrers API or tag-schema fallback.

func ExtractTar

func ExtractTar(raw []byte, directory string) error

ExtractTar validates a bounded, already verified tar payload before using the shared confined extractor. Links, duplicate names, special files, and modes other than ordinary files/directories are rejected before any write.

func FetchBytes

func FetchBytes(ctx context.Context, store Fetcher, target ocispec.Descriptor, limit int64) ([]byte, error)

FetchBytes reads and verifies a small blob. The size limit is checked before and while reading; both the declared size and the digest must match, so oversized or tampered content never reaches callers.

func GHCRAuth

func GHCRAuth(atmosConfig *schema.AtmosConfiguration) (authn.Authenticator, string)

GHCRAuth returns authentication credentials for GitHub Container Registry (ghcr.io) derived from Atmos settings, along with a human-readable source description. It returns (nil, "") when no usable credentials are configured so callers can fall back to anonymous access or the default keychain.

func ImportIndex

func ImportIndex(ctx context.Context, destination Registry, directory string, ref name.Reference) error

ImportIndex uploads a layout with the destination's credentials, independent of any source registry credentials used to create it.

func IsAlreadyExists

func IsAlreadyExists(err error) bool

IsAlreadyExists reports whether a push found the identical content already stored, which content addressing makes a success for the writer.

func IsCatalogUnavailable

func IsCatalogUnavailable(err error) bool

IsCatalogUnavailable identifies responses indicating that a registry does not expose a catalog.

func IsNotFound

func IsNotFound(err error) bool

IsNotFound distinguishes a missing manifest from auth and transport failures. It recognizes errors from both the legacy and the ORAS-backed transport.

func LoadIndex

func LoadIndex(directory, expected string) (v1.ImageIndex, error)

LoadIndex opens the single root index in an OCI layout, optionally enforcing its expected digest. Referenced blobs remain lazy so callers can select one platform; they must validate that platform's bytes before materializing it.

func PinDigest added in v1.230.0

func PinDigest(imageName, digest string) (string, error)

PinDigest re-expresses imageName with digest bound as an explicit "repo@sha256:..." reference, discarding any tag, so a later fetch of the returned string resolves to the exact manifest identified by digest instead of whatever a mutable tag currently points to. Callers that need to re-fetch reproducibly later should record digest (from ResolveImage) and re-derive the pinned reference via this function rather than storing a tag.

func ProcessImage

func ProcessImage(ctx context.Context, atmosConfig *schema.AtmosConfiguration, imageName string, destDir string) error

ProcessImage pulls an OCI image and extracts its layers to the specified destination directory. The context bounds the pull (registry auth plus manifest/layer fetch) -- callers should pass one with a deadline, matching the timeout the go-getter download path already enforces.

func ReadVerifiedBlob

func ReadVerifiedBlob(reader io.Reader, expected *v1.Descriptor, limit int64) ([]byte, error)

ReadVerifiedBlob enforces a byte limit and checks both size and digest before exposing data. It works identically for registry and offline-layout blobs.

func ResolveAuthentication

func ResolveAuthentication(config *schema.AtmosConfiguration, chain authn.Keychain, resource authn.Resource) (authn.Authenticator, string, error)

ResolveAuthentication keeps Docker/helper credentials ahead of GHCR settings. Resolver errors fail closed; mutation callers must never fall back to anonymous.

func SaveIndex

func SaveIndex(directory string, index v1.ImageIndex) error

SaveIndex writes a complete index to a standard OCI layout. The outer layout index contains exactly one descriptor for the unchanged release index.

func SaveSelection

func SaveSelection(directory string, index v1.ImageIndex, selected []v1.Hash) error

SaveSelection retains an unchanged index and all child manifests/configs, downloading layers only for selected image digests. The resulting partial layout supports offline inspection and restoration of those platforms. Nested indexes are rejected explicitly; they must use SaveIndex instead.

func WithRetryObserver added in v1.229.0

func WithRetryObserver(ctx context.Context, observer func(int)) context.Context

WithRetryObserver routes retry notices to the caller and suppresses terminal diagnostics during this operation. Errors are still returned to the caller. The observer is scoped to this context, including provenance resolution.

Types

type AuthenticationResolver

type AuthenticationResolver interface {
	Resolve(context.Context, authn.Resource) (authn.Authenticator, bool, error)
}

AuthenticationResolver resolves explicitly bound identities before ambient credentials. The matched result distinguishes an unbound host from a failed configured identity.

type Client

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

Client performs registry operations without plugin or component semantics.

func NewClient

func NewClient(config *schema.AtmosConfiguration, options ...ClientOption) *Client

NewClient constructs a client using the existing Docker and GHCR auth policy.

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, ref name.Digest) error

Delete deletes only an explicitly selected digest, never a mutable tag.

func (*Client) Get

func (c *Client) Get(ctx context.Context, ref name.Reference) (*remote.Descriptor, error)

Get resolves an index or image without selecting a platform or extracting it.

func (*Client) Head

func (c *Client) Head(ctx context.Context, ref name.Reference) (*v1.Descriptor, error)

Head resolves the immutable descriptor without downloading artifact layers. It runs on the shared ORAS transport.

func (*Client) Referrers

func (c *Client) Referrers(ctx context.Context, ref name.Digest) (v1.ImageIndex, error)

Referrers uses the shared credentials and transport, including the standard referrers-tag fallback on registries without the OCI 1.1 API. Attachment descriptors are returned as an index; no content is fetched.

func (*Client) Repositories

func (c *Client) Repositories(ctx context.Context, registry string) ([]string, error)

Repositories lists the repositories of a registry with credentials resolved up front, exactly like Repository. A rejected or unsupported catalog request is returned as an error.

func (*Client) Repository

func (c *Client) Repository(ctx context.Context, repository Repository) (RepositoryStore, error)

Repository opens a registry repository with credentials resolved up front. Resolution follows the same precedence as the legacy methods (bound identity, keychain, GHCR settings, fallback); an explicitly bound identity that fails stops here, before any request, and is never replaced by anonymous access.

Every call builds a new credential cache, so tokens obtained for one identity can never be presented by another client or for another repository open.

func (*Client) Tags

func (c *Client) Tags(ctx context.Context, repo name.Repository) ([]string, error)

Tags lists repository tags without interpreting them as versions.

func (*Client) WriteImage

func (c *Client) WriteImage(ctx context.Context, ref name.Reference, img v1.Image) error

WriteImage uploads an image and its blobs, preserving the image's existing raw bytes. Rejected writes never retry anonymously, and an unknown outcome is reconciled by resolving the destination rather than writing again. Only OCI and Docker schema 2 images are supported: a schema 1 image is refused with an integrity error before any layer is read.

func (*Client) WriteIndex

func (c *Client) WriteIndex(ctx context.Context, ref name.Reference, index v1.ImageIndex) error

WriteIndex uploads the complete index and its children without platform filtering.

type ClientOption

type ClientOption func(*Client)

ClientOption configures authentication or transport for one client.

func WithAuthenticationResolver

func WithAuthenticationResolver(resolver AuthenticationResolver) ClientOption

WithAuthenticationResolver binds a context-aware identity resolver to this client. Configured identities never fall through to Docker helpers or environment credentials.

func WithCredentialFallback

func WithCredentialFallback(chain authn.Keychain) ClientOption

WithCredentialFallback supplies credentials after Docker helpers and GHCR settings. It does not retry failed authenticated registry requests with another identity.

func WithKeychain

func WithKeychain(keychain authn.Keychain) ClientOption

WithKeychain sets a repository-aware credential resolver. Callers transferring between registries can supply separate source and destination clients.

func WithTransport

func WithTransport(transport http.RoundTripper) ClientOption

WithTransport supplies TLS, CA, proxy, and instrumentation settings.

type CopyOption

type CopyOption func(*copyConfig)

CopyOption configures a graph copy.

func WithCopyConcurrency

func WithCopyConcurrency(concurrency int) CopyOption

WithCopyConcurrency bounds how many nodes transfer at once. Values below one use the default.

func WithCopyObserver

func WithCopyObserver(observe func(ocispec.Descriptor)) CopyOption

WithCopyObserver reports every node that was actually transferred (not skipped as present). The observer may be called from several goroutines concurrently, so it must be safe for concurrent use.

func WithoutSubjectTraversal

func WithoutSubjectTraversal() CopyOption

WithoutSubjectTraversal stops the copy at the selected manifest instead of also copying the manifest named by its subject field. Legacy writers (for example signature attachments) publish an attachment next to a subject that already exists at the destination. An extended copy still reaches the selected manifest through the subject edges of its referrers.

type CredentialKeychain

type CredentialKeychain struct {
	Store    keyring.Keyring
	Open     func() (keyring.Keyring, error)
	Optional bool
}

CredentialKeychain stores registry credentials in the shared Atmos keyring. Registry names, not package aliases, determine credential scope.

func (CredentialKeychain) Login

func (k CredentialKeychain) Login(registry string, config *authn.AuthConfig) error

Login records explicit credentials for a registry without changing source configuration.

func (CredentialKeychain) Logout

func (k CredentialKeychain) Logout(registry string) error

Logout removes only Atmos's stored credentials for the selected registry.

func (CredentialKeychain) Resolve

func (k CredentialKeychain) Resolve(resource authn.Resource) (authn.Authenticator, error)

Resolve implements the standard OCI keychain interface.

type Destination

type Destination struct {
	Store     Store
	Reference string
}

Destination names where a copy writes: a store and the reference the root is published under. An empty Reference reuses the source reference.

type Fetcher

type Fetcher interface {
	// Fetch streams the content identified by the descriptor.
	Fetch(ctx context.Context, target ocispec.Descriptor) (io.ReadCloser, error)
}

Fetcher streams content by descriptor.

type GraphSource

type GraphSource struct {
	Store     ReadOnlyGraphStore
	Reference string
}

GraphSource is a Source that can also report predecessors, for extended copies.

type GraphStore

type GraphStore interface {
	Store
	// Predecessors returns manifests whose subject or children include the node.
	Predecessors(ctx context.Context, node ocispec.Descriptor) ([]ocispec.Descriptor, error)
}

GraphStore additionally discovers the manifests that point at a descriptor, which is how referrers and signatures are found for extended copies.

type Layout

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

Layout is a writable OCI image layout that can hold any number of named roots.

It keeps index.json limited to the roots a caller explicitly tagged. Child manifests and blobs live only under blobs/, exactly like the single-release layouts written by SaveIndex, so a layout that holds one release still satisfies LoadIndex. A layout with several references is intentionally rejected by LoadIndex; read it through Layout.

Layout does not coordinate concurrent writers in other processes.

func OpenLayout

func OpenLayout(ctx context.Context, directory string) (*Layout, error)

OpenLayout opens or creates a layout directory.

func (*Layout) Exists

func (l *Layout) Exists(ctx context.Context, target ocispec.Descriptor) (bool, error)

Exists reports whether the blob is in the layout.

func (*Layout) Fetch

func (l *Layout) Fetch(ctx context.Context, target ocispec.Descriptor) (io.ReadCloser, error)

Fetch streams a blob from the layout.

func (*Layout) Predecessors

func (l *Layout) Predecessors(ctx context.Context, node ocispec.Descriptor) ([]ocispec.Descriptor, error)

Predecessors lists manifests in the layout that reference the node.

func (*Layout) Push

func (l *Layout) Push(ctx context.Context, expected ocispec.Descriptor, content io.Reader) error

Push writes a digest-verified blob. Pushing existing content reports ErrAlreadyExists. A manifest that names a subject (a signature, SBOM, or other attachment) is also recorded as an unnamed root, because that is the only way its relationship to the subject survives reopening the layout.

func (*Layout) References

func (l *Layout) References() []string

References returns the named roots in index.json in insertion order.

func (*Layout) Resolve

func (l *Layout) Resolve(ctx context.Context, reference string) (ocispec.Descriptor, error)

Resolve resolves a reference name or digest to a descriptor.

func (*Layout) Tag

func (l *Layout) Tag(ctx context.Context, desc ocispec.Descriptor, reference string) error

Tag records reference as a named root in index.json. A digest reference is recorded as an unnamed root unless the digest is already listed. An unnamed root with the same digest is named in place, so a legacy single-release layout keeps exactly one entry.

func (*Layout) Untag

func (l *Layout) Untag(ctx context.Context, reference string) error

Untag removes a named root from index.json without touching blobs, which may be shared by other references. Digest references are implicit and cannot be untagged.

type MockReadOnlyStore

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

MockReadOnlyStore is a mock of ReadOnlyStore interface.

func NewMockReadOnlyStore

func NewMockReadOnlyStore(ctrl *gomock.Controller) *MockReadOnlyStore

NewMockReadOnlyStore creates a new mock instance.

func (*MockReadOnlyStore) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockReadOnlyStore) Exists

func (m *MockReadOnlyStore) Exists(ctx context.Context, target v1.Descriptor) (bool, error)

Exists mocks base method.

func (*MockReadOnlyStore) Fetch

func (m *MockReadOnlyStore) Fetch(ctx context.Context, target v1.Descriptor) (io.ReadCloser, error)

Fetch mocks base method.

func (*MockReadOnlyStore) Resolve

func (m *MockReadOnlyStore) Resolve(ctx context.Context, reference string) (v1.Descriptor, error)

Resolve mocks base method.

type MockReadOnlyStoreMockRecorder

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

MockReadOnlyStoreMockRecorder is the mock recorder for MockReadOnlyStore.

func (*MockReadOnlyStoreMockRecorder) Exists

func (mr *MockReadOnlyStoreMockRecorder) Exists(ctx, target any) *gomock.Call

Exists indicates an expected call of Exists.

func (*MockReadOnlyStoreMockRecorder) Fetch

func (mr *MockReadOnlyStoreMockRecorder) Fetch(ctx, target any) *gomock.Call

Fetch indicates an expected call of Fetch.

func (*MockReadOnlyStoreMockRecorder) Resolve

func (mr *MockReadOnlyStoreMockRecorder) Resolve(ctx, reference any) *gomock.Call

Resolve indicates an expected call of Resolve.

type MockRepositoryStore

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

MockRepositoryStore is a mock of RepositoryStore interface.

func NewMockRepositoryStore

func NewMockRepositoryStore(ctrl *gomock.Controller) *MockRepositoryStore

NewMockRepositoryStore creates a new mock instance.

func (*MockRepositoryStore) Delete

func (m *MockRepositoryStore) Delete(ctx context.Context, target v1.Descriptor) error

Delete mocks base method.

func (*MockRepositoryStore) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockRepositoryStore) Exists

func (m *MockRepositoryStore) Exists(ctx context.Context, target v1.Descriptor) (bool, error)

Exists mocks base method.

func (*MockRepositoryStore) Fetch

Fetch mocks base method.

func (*MockRepositoryStore) Predecessors

func (m *MockRepositoryStore) Predecessors(ctx context.Context, node v1.Descriptor) ([]v1.Descriptor, error)

Predecessors mocks base method.

func (*MockRepositoryStore) Push

func (m *MockRepositoryStore) Push(ctx context.Context, expected v1.Descriptor, content io.Reader) error

Push mocks base method.

func (*MockRepositoryStore) PushReference

func (m *MockRepositoryStore) PushReference(ctx context.Context, expected v1.Descriptor, content io.Reader, reference string) error

PushReference mocks base method.

func (*MockRepositoryStore) Referrers

func (m *MockRepositoryStore) Referrers(ctx context.Context, subject v1.Descriptor, artifactType string) ([]v1.Descriptor, error)

Referrers mocks base method.

func (*MockRepositoryStore) Resolve

func (m *MockRepositoryStore) Resolve(ctx context.Context, reference string) (v1.Descriptor, error)

Resolve mocks base method.

func (*MockRepositoryStore) Tag

func (m *MockRepositoryStore) Tag(ctx context.Context, desc v1.Descriptor, reference string) error

Tag mocks base method.

func (*MockRepositoryStore) Tags

func (m *MockRepositoryStore) Tags(ctx context.Context) ([]string, error)

Tags mocks base method.

type MockRepositoryStoreMockRecorder

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

MockRepositoryStoreMockRecorder is the mock recorder for MockRepositoryStore.

func (*MockRepositoryStoreMockRecorder) Delete

func (mr *MockRepositoryStoreMockRecorder) Delete(ctx, target any) *gomock.Call

Delete indicates an expected call of Delete.

func (*MockRepositoryStoreMockRecorder) Exists

func (mr *MockRepositoryStoreMockRecorder) Exists(ctx, target any) *gomock.Call

Exists indicates an expected call of Exists.

func (*MockRepositoryStoreMockRecorder) Fetch

func (mr *MockRepositoryStoreMockRecorder) Fetch(ctx, target any) *gomock.Call

Fetch indicates an expected call of Fetch.

func (*MockRepositoryStoreMockRecorder) Predecessors

func (mr *MockRepositoryStoreMockRecorder) Predecessors(ctx, node any) *gomock.Call

Predecessors indicates an expected call of Predecessors.

func (*MockRepositoryStoreMockRecorder) Push

func (mr *MockRepositoryStoreMockRecorder) Push(ctx, expected, content any) *gomock.Call

Push indicates an expected call of Push.

func (*MockRepositoryStoreMockRecorder) PushReference

func (mr *MockRepositoryStoreMockRecorder) PushReference(ctx, expected, content, reference any) *gomock.Call

PushReference indicates an expected call of PushReference.

func (*MockRepositoryStoreMockRecorder) Referrers

func (mr *MockRepositoryStoreMockRecorder) Referrers(ctx, subject, artifactType any) *gomock.Call

Referrers indicates an expected call of Referrers.

func (*MockRepositoryStoreMockRecorder) Resolve

func (mr *MockRepositoryStoreMockRecorder) Resolve(ctx, reference any) *gomock.Call

Resolve indicates an expected call of Resolve.

func (*MockRepositoryStoreMockRecorder) Tag

func (mr *MockRepositoryStoreMockRecorder) Tag(ctx, desc, reference any) *gomock.Call

Tag indicates an expected call of Tag.

func (*MockRepositoryStoreMockRecorder) Tags

Tags indicates an expected call of Tags.

type MockStore

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

MockStore is a mock of Store interface.

func NewMockStore

func NewMockStore(ctrl *gomock.Controller) *MockStore

NewMockStore creates a new mock instance.

func (*MockStore) EXPECT

func (m *MockStore) EXPECT() *MockStoreMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockStore) Exists

func (m *MockStore) Exists(ctx context.Context, target v1.Descriptor) (bool, error)

Exists mocks base method.

func (*MockStore) Fetch

func (m *MockStore) Fetch(ctx context.Context, target v1.Descriptor) (io.ReadCloser, error)

Fetch mocks base method.

func (*MockStore) Push

func (m *MockStore) Push(ctx context.Context, expected v1.Descriptor, content io.Reader) error

Push mocks base method.

func (*MockStore) Resolve

func (m *MockStore) Resolve(ctx context.Context, reference string) (v1.Descriptor, error)

Resolve mocks base method.

func (*MockStore) Tag

func (m *MockStore) Tag(ctx context.Context, desc v1.Descriptor, reference string) error

Tag mocks base method.

type MockStoreMockRecorder

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

MockStoreMockRecorder is the mock recorder for MockStore.

func (*MockStoreMockRecorder) Exists

func (mr *MockStoreMockRecorder) Exists(ctx, target any) *gomock.Call

Exists indicates an expected call of Exists.

func (*MockStoreMockRecorder) Fetch

func (mr *MockStoreMockRecorder) Fetch(ctx, target any) *gomock.Call

Fetch indicates an expected call of Fetch.

func (*MockStoreMockRecorder) Push

func (mr *MockStoreMockRecorder) Push(ctx, expected, content any) *gomock.Call

Push indicates an expected call of Push.

func (*MockStoreMockRecorder) Resolve

func (mr *MockStoreMockRecorder) Resolve(ctx, reference any) *gomock.Call

Resolve indicates an expected call of Resolve.

func (*MockStoreMockRecorder) Tag

func (mr *MockStoreMockRecorder) Tag(ctx, desc, reference any) *gomock.Call

Tag indicates an expected call of Tag.

type MockTransport

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

MockTransport is a mock of Transport interface.

func NewMockTransport

func NewMockTransport(ctrl *gomock.Controller) *MockTransport

NewMockTransport creates a new mock instance.

func (*MockTransport) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockTransport) Repository

func (m *MockTransport) Repository(ctx context.Context, repository Repository) (RepositoryStore, error)

Repository mocks base method.

type MockTransportMockRecorder

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

MockTransportMockRecorder is the mock recorder for MockTransport.

func (*MockTransportMockRecorder) Repository

func (mr *MockTransportMockRecorder) Repository(ctx, repository any) *gomock.Call

Repository indicates an expected call of Repository.

type ReadOnlyGraphStore

type ReadOnlyGraphStore interface {
	ReadOnlyStore
	// Predecessors returns manifests whose subject or children include the node.
	Predecessors(ctx context.Context, node ocispec.Descriptor) ([]ocispec.Descriptor, error)
}

ReadOnlyGraphStore is a source that can also report predecessors (referrers).

func OpenLayoutReadOnly

func OpenLayoutReadOnly(ctx context.Context, directory string) (ReadOnlyGraphStore, error)

OpenLayoutReadOnly opens an existing layout without ever writing to it, so committed fixtures and offline media stay untouched.

type ReadOnlyStore

type ReadOnlyStore interface {
	// Fetch streams the content identified by the descriptor.
	Fetch(ctx context.Context, target ocispec.Descriptor) (io.ReadCloser, error)
	// Exists reports whether the content is present.
	Exists(ctx context.Context, target ocispec.Descriptor) (bool, error)
	// Resolve resolves a tag or digest reference to a descriptor.
	Resolve(ctx context.Context, reference string) (ocispec.Descriptor, error)
}

ReadOnlyStore is the source side of a graph copy.

type ReferencePusher

type ReferencePusher interface {
	PushReference(ctx context.Context, expected ocispec.Descriptor, content io.Reader, reference string) error
}

ReferencePusher pushes a manifest directly under a tag or digest reference.

type ReferrerRegistry

type ReferrerRegistry interface {
	Registry
	Referrers(context.Context, name.Digest) (v1.ImageIndex, error)
}

ReferrerRegistry extends OCI transport with OCI 1.1 attachment discovery.

type Registry

Registry is the transport boundary shared by OCI consumers. Images and indexes retain their original bytes; package-specific extraction lives above it. A client resolves credentials independently for every repository operation.

type RegistryCatalog

type RegistryCatalog interface {
	// Repositories lists every repository name the registry reports, in registry order.
	Repositories(ctx context.Context, registry string) ([]string, error)
}

RegistryCatalog lists the repositories a registry exposes through its repository catalog (GET /v2/_catalog). Many registries do not implement it; callers must treat a failure as "enumeration is unsupported" and never as an empty registry.

type Repository

type Repository struct {
	Registry string
	Path     string
	// Insecure selects plain HTTP for a registry that name.Insecure marked, so every operation on
	// the repository uses the same scheme. Loopback registries use plain HTTP without it.
	Insecure bool
}

Repository identifies one OCI repository independently of any client library. Registry is the host (with optional port) and Path the repository name.

func ParseRepository

func ParseRepository(value string) (Repository, error)

ParseRepository validates "registry/path" using the same rules as the legacy client, so loopback registries still use plain HTTP and Docker Hub short names are normalized.

func (Repository) String

func (r Repository) String() string

String returns "registry/path".

type RepositoryStore

type RepositoryStore interface {
	GraphStore
	ReferencePusher
	// Tags lists every tag without interpreting it as a version.
	Tags(ctx context.Context) ([]string, error)
	// Delete removes a manifest by its full descriptor. Tags pointing to that digest may stop resolving; shared blobs are not deleted. A
	// descriptor with only a digest deletes the manifest without reading it first.
	Delete(ctx context.Context, target ocispec.Descriptor) error
	// Referrers lists attachments of the subject, optionally filtered by artifact type.
	// Registries without the OCI 1.1 API use the referrers tag-schema fallback.
	Referrers(ctx context.Context, subject ocispec.Descriptor, artifactType string) ([]ocispec.Descriptor, error)
}

RepositoryStore is a registry repository opened with already-resolved credentials.

type ResolvedImage added in v1.225.0

type ResolvedImage struct {
	Reference string
	Digest    string
	MediaType string
}

ResolvedImage is the immutable registry identity selected for an OCI source. Digest is the descriptor digest for the selected manifest; it is suitable for locks and SBOM provenance, unlike the mutable declared tag/reference.

func ResolveImage added in v1.225.0

func ResolveImage(ctx context.Context, atmosConfig *schema.AtmosConfiguration, imageName string) (*ResolvedImage, error)

ResolveImage authenticates and resolves an OCI reference without extracting layers. It is the public provenance boundary for OCI consumers.

type Source

type Source struct {
	Store     ReadOnlyStore
	Reference string
}

Source names the content a copy reads: a store and a tag or digest reference within it.

type Store

type Store interface {
	// Fetch streams the content identified by the descriptor.
	Fetch(ctx context.Context, target ocispec.Descriptor) (io.ReadCloser, error)
	// Exists reports whether the content is already present.
	Exists(ctx context.Context, target ocispec.Descriptor) (bool, error)
	// Push stores content that must match the expected descriptor's size and digest.
	Push(ctx context.Context, expected ocispec.Descriptor, content io.Reader) error
	// Resolve resolves a tag or digest reference to a descriptor.
	Resolve(ctx context.Context, reference string) (ocispec.Descriptor, error)
	// Tag associates a reference with an existing manifest descriptor.
	Tag(ctx context.Context, desc ocispec.Descriptor, reference string) error
}

Store is a content-addressed OCI graph store. Its method set deliberately mirrors the ORAS target contract so any implementation (registry, layout, in-memory, legacy adapter) can participate in graph copy. Only OCI image-spec descriptors and go-digest values appear in the signature.

type Transport

type Transport interface {
	Repository(ctx context.Context, repository Repository) (RepositoryStore, error)
}

Transport opens repositories. Credentials are resolved when a repository is opened, so a failed identity fails before any network request and never downgrades to anonymous.

Directories

Path Synopsis
Package ocitest provides an in-process OCI registry for tests, so tests never depend on real network access or a real container registry.
Package ocitest provides an in-process OCI registry for tests, so tests never depend on real network access or a real container registry.
Package signature adapts the shared Sigstore verification primitives in pkg/signature to OCI attachments and plugin trust requirements.
Package signature adapts the shared Sigstore verification primitives in pkg/signature to OCI attachments and plugin trust requirements.
signaturetest
Package signaturetest keeps the historical import path for the isolated Sigstore test authority.
Package signaturetest keeps the historical import path for the isolated Sigstore test authority.

Jump to

Keyboard shortcuts

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