Documentation
¶
Index ¶
- Constants
- Variables
- type Client
- func (c *Client) EnsureEmptyConfig(ctx context.Context) error
- func (c *Client) Exists(ctx context.Context, desc ocispec.Descriptor) (bool, error)
- func (c *Client) FetchBlob(ctx context.Context, desc ocispec.Descriptor) (io.ReadCloser, error)
- func (c *Client) FetchManifest(ctx context.Context, reference string) (ocispec.Descriptor, io.ReadCloser, error)
- func (c *Client) PushBlob(ctx context.Context, desc ocispec.Descriptor, content io.Reader) error
- func (c *Client) PushManifest(ctx context.Context, desc ocispec.Descriptor, content io.Reader, tag string) error
- func (c *Client) Referrers(ctx context.Context, subject ocispec.Descriptor, artifactType string, ...) error
- func (c *Client) ReferrersSupported(ctx context.Context, subject ocispec.Descriptor) bool
- func (c *Client) Resolve(ctx context.Context, reference string) (ocispec.Descriptor, error)
- func (c *Client) Tag(ctx context.Context, desc ocispec.Descriptor, tag string) error
- func (c *Client) Tags(ctx context.Context, last string, fn func(tags []string) error) error
- type ManifestBuilder
Constants ¶
const ( ArtifactTypeMessage = "application/vnd.dockercomms.message.v1" ArtifactTypeReceipt = "application/vnd.dockercomms.receipt.v1" ArtifactTypeBundle = "application/vnd.dev.sigstore.bundle.v0.3+json" MediaTypeManifest = ocispec.MediaTypeImageManifest MediaTypeChunkGzip = "application/vnd.dockercomms.chunk.v1.tar+gzip" MediaTypeChunkZstd = "application/vnd.dockercomms.chunk.v1.tar+zstd" MediaTypeEmptyConfig = "application/vnd.oci.empty.v1+json" MediaTypeBundleConfig = ArtifactTypeBundle )
Artifact and media types per SPEC.md.
Variables ¶
var EmptyConfigDescriptor = ocispec.Descriptor{ MediaType: MediaTypeEmptyConfig, Digest: digest.Digest("sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a"), Size: 2, }
Empty config descriptor per spec (J).
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps oras-go remote repository for OCI operations.
func NewClient ¶
NewClient creates an OCI client for the given registry/repo reference. Reference format: registry/repo (e.g. ghcr.io/user/repo).
func (*Client) EnsureEmptyConfig ¶
EnsureEmptyConfig pushes the canonical empty config blob if not present.
func (*Client) FetchBlob ¶
func (c *Client) FetchBlob(ctx context.Context, desc ocispec.Descriptor) (io.ReadCloser, error)
FetchBlob downloads a blob.
func (*Client) FetchManifest ¶
func (c *Client) FetchManifest(ctx context.Context, reference string) (ocispec.Descriptor, io.ReadCloser, error)
FetchManifest fetches manifest by tag or digest.
func (*Client) PushBlob ¶
PushBlob uploads a blob. Skips if Exists returns true (caller responsibility for resume).
func (*Client) PushManifest ¶
func (c *Client) PushManifest(ctx context.Context, desc ocispec.Descriptor, content io.Reader, tag string) error
PushManifest pushes a manifest and tags it.
func (*Client) Referrers ¶
func (c *Client) Referrers(ctx context.Context, subject ocispec.Descriptor, artifactType string, fn func([]ocispec.Descriptor) error) error
Referrers lists referrers for the given subject. artifactType filters by type (empty = all).
func (*Client) ReferrersSupported ¶
ReferrersSupported returns true if the registry supports the Referrers API. Best-effort: attempts a referrers call with a valid digest; on 404/unsupported returns false.
type ManifestBuilder ¶
type ManifestBuilder struct {
ArtifactType string
Subject *ocispec.Descriptor
Annotations map[string]string
Layers []ocispec.Descriptor
}
ManifestBuilder builds OCI manifest with DockerComms annotations.
func NewBundleManifest ¶
func NewBundleManifest(subject ocispec.Descriptor, bundleAnnotations map[string]string, layer ocispec.Descriptor) *ManifestBuilder
NewBundleManifest creates a manifest builder for a bundle artifact with subject for referrers.
func NewMessageManifest ¶
func NewMessageManifest(annotations map[string]string, layers []ocispec.Descriptor) *ManifestBuilder
NewMessageManifest creates a manifest builder for a message artifact.
func NewReceiptManifest ¶
func NewReceiptManifest(annotations map[string]string) *ManifestBuilder
NewReceiptManifest creates a manifest builder for a receipt artifact.
func (*ManifestBuilder) Build ¶
func (b *ManifestBuilder) Build() ([]byte, ocispec.Descriptor, error)
Build produces the OCI manifest JSON and descriptor.