Stevedore.Referrers (Stevedore v0.2.0)

Copy Markdown View Source

Attach artifacts to an image and list them — the OCI 1.1 subject/artifactType mechanism that signatures, SBOMs, and scan results hang off of.

An artifact is an ordinary manifest carrying a subject descriptor pointing at the image it refers to. attach/4 sets that subject and pushes the artifact; list/3 returns the referrers index — via the registry Referrers API (with the <algo>-<hex> tag-schema fallback) for docker://, or by scanning stored subject fields for a local registry tree.

Spec: distribution-spec, Referrers API and image-spec, manifest subject.

Summary

Functions

Attaches artifact to the image identified by subject on transport, setting the artifact's subject to the (freshly fetched) subject descriptor and pushing it. Returns the artifact's manifest digest.

Builds the referrers index (as a Stevedore.Manifest.t/0) for subject by scanning a local registry tree's stored subject fields. Used by the registry server's referrers endpoint.

Lists referrers to subject on transport, returning the referrers image-index as a Stevedore.Manifest.t/0.

Types

artifact()

@type artifact() ::
  Stevedore.Image.t()
  | %{
      :media_type => String.t(),
      :data => binary(),
      optional(:artifact_type) => String.t()
    }

Functions

attach(transport, subject, artifact, opts \\ [])

@spec attach(Stevedore.Transport.t(), Stevedore.Digest.t(), artifact(), keyword()) ::
  {:ok, Stevedore.Digest.t()} | {:error, term()}

Attaches artifact to the image identified by subject on transport, setting the artifact's subject to the (freshly fetched) subject descriptor and pushing it. Returns the artifact's manifest digest.

index_for(transport, subject)

Builds the referrers index (as a Stevedore.Manifest.t/0) for subject by scanning a local registry tree's stored subject fields. Used by the registry server's referrers endpoint.

list(transport, subject, opts \\ [])

@spec list(Stevedore.Transport.t(), Stevedore.Digest.t(), keyword()) ::
  {:ok, Stevedore.Manifest.t()} | {:error, term()}

Lists referrers to subject on transport, returning the referrers image-index as a Stevedore.Manifest.t/0.