Regc.Mutate.Manifest (regc v0.0.2)

View Source

Immutable manifest and index transformations.

OCI annotations are preserved by default. Conversion to Docker media types rejects OCI-only fields unless allow_lossy: true is explicitly supplied.

Summary

Functions

Converts OCI image/index descriptor media types to Docker schema 2, or the reverse.

Removes an OCI annotation.

Sets an OCI annotation. A nil value removes the annotation.

Records the OCI base-image name and digest annotations used by rebasing.

Functions

convert_media_types(mutation, target, opts \\ [])

@spec convert_media_types(Regc.Mutate.Image.t(), :oci | :docker, keyword()) ::
  {:ok, Regc.Mutate.Image.t()} | {:error, Regc.Error.t()}

Converts OCI image/index descriptor media types to Docker schema 2, or the reverse.

Docker schema 2 cannot represent OCI subjects, artifact types, annotations, inline descriptor data, or artifact manifests. OCI-only fields therefore cause a :lossy_conversion error unless allow_lossy: true is supplied. Artifact manifests are never converted to Docker.

Converting an index also requires a :child_descriptors map keyed by each source child digest whose media type changes. Values may be finalized mutation results, mutation states, descriptors, or descriptor maps. This prevents relabeling a child while retaining a digest for different bytes.

delete_annotation(mutation, name)

@spec delete_annotation(Regc.Mutate.Image.t(), String.t()) ::
  {:ok, Regc.Mutate.Image.t()} | {:error, Regc.Error.t()}

Removes an OCI annotation.

put_annotation(mutation, name, value)

@spec put_annotation(Regc.Mutate.Image.t(), String.t(), String.t() | nil) ::
  {:ok, Regc.Mutate.Image.t()} | {:error, Regc.Error.t()}

Sets an OCI annotation. A nil value removes the annotation.

put_base(mutation, name, digest)

@spec put_base(Regc.Mutate.Image.t(), String.t(), String.t()) ::
  {:ok, Regc.Mutate.Image.t()} | {:error, Regc.Error.t()}

Records the OCI base-image name and digest annotations used by rebasing.