Generates OCI image annotations from LowEndInsight analysis reports.
Annotations follow the dev.lowendinsight.* namespace using OCI annotation
conventions (reverse-DNS prefix, hyphenated keys, string values).
See docs/OCI_ANNOTATION_SCHEMA.md for the full schema specification.
Summary
Functions
Generates a map of OCI annotation key-value pairs from a single-repo LEI report.
Generates OCI annotations directly from a results map, repo URL, and timestamp.
Returns annotations as a list of --annotation key=value CLI flag strings,
suitable for passing to docker buildx build or oras push.
Encodes annotations as a JSON string suitable for --annotation-file flags
in OCI tooling (crane, oras, docker buildx).
Functions
Generates a map of OCI annotation key-value pairs from a single-repo LEI report.
Returns {:ok, map} where all keys are dev.lowendinsight.* strings and all
values are strings (per OCI spec). Returns {:error, reason} for unsupported formats.
Examples
iex> report = %{header: %{start_time: "2024-01-01T00:00:00Z"}, data: %{repo: "https://github.com/org/repo", results: %{risk: "critical", contributor_count: 1}}}
iex> {:ok, annotations} = Lei.OCI.Annotations.from_report(report)
iex> annotations["dev.lowendinsight.risk"]
"critical"
Generates OCI annotations directly from a results map, repo URL, and timestamp.
Useful when you already have extracted analysis results and don't need to parse a full report structure.
Returns annotations as a list of --annotation key=value CLI flag strings,
suitable for passing to docker buildx build or oras push.
Encodes annotations as a JSON string suitable for --annotation-file flags
in OCI tooling (crane, oras, docker buildx).