Open phoban01 opened 1 year ago
@mandelsoft and @hilmarf , what do you think about this? Querying an OCI registry to get all versions of a dedicated component already can take a while. Such a feature would also be beneficial for the "Component UI" that we wanted to provide for MPAS for end users to search for available products (modelled as OCM components).
This issue was marked as stale because it has not had recent activity.
Problem
Currently it is not possible to list, and therefore discover, OCM components that are stored in an OCI Repository. This is a property of the OCI specification, which does not support listing images stored repository.
Proposal
I propose that we introduce the concept of a
component-index
. Thecomponent-index
is a repository with a "well-known" name which can be used to describe all components housed in the registry. For example, the component index might be as follwos:ghcr.io/open-component-model/component-index
.Within this repository there is a manifest acting as the index, for example:
ghcr.io/component-index/v1:index.ocm
. This is an OCI image (likely without any layers) that exists purely as a reference point for other images.When a new component version is pushed to the registry we also push a corresponding artifact to the
component-index
repository. This artifact should specify the digest ofcomponent-index
as thesubject
. The "Subject" field is part of the OCI 1.1 spec and will require updatinggithub.com/opencontainers/image-spec
to versionv1.1.0-rc2
.Listing components can then be performed by querying the referrers API for the
v1:index.ocm
:GET /v2/component-index/referrers/<digest for v1:index.ocm>
This will return an `ImageIndex which can be used to display the available components in a particular registry.
Furthermore, if we specify metadata about the particular component as an annotation on the artifact (such as the provider) we could filter the list of components based on particular metadata fields.
OCI Referrers API Context
The OCI Distribution Spec v1.0.1 introduces support for the
Referrers API
. In tandem with the Artifact Manifest'ssubject
field (part of the OCI Image Spec) it is possible to indicate relationships between OCI artifacts.For example, the following manifest is an SBOM that references an image:
Using the referrers API which can list all references to the
subject
which returns an image index containing a list of descriptors:GET /v2/<name>/referrers/<digest>