Skip to content

Support for Tags in OCM repositories #720

@schulzh

Description

@schulzh

Description
In our scenario, we want to assemble a microservice application as an OCM descriptor and push it to a repository. Afterwards, we want to qualify it in different stages and do testing on it. To track what the current OCM for a given stage is, we would like to have a tagging mechanism, basically the same way that OCI supports tags. Currently only the latest tag is supported by OCM, but we would like to set tags with arbitrary names (in our case the stage names). Apparently latest is also not set, instead OCM resolves this with max(version), which is terribly inefficient.

Alternatives concidered:

  • We will be exploring setting tags on the OCI repository directly, but this is breaking the OCM abstraction, which we would like to avoid.
    * It is currently possible to push a "referencing OCM" spec to the repository with the stage name and then resolve it by latest, but this adds a lot of complexity and unnecessary overhead.
  • We could download and change the OCM name to contain the stage name and then reupload, but this changes the digests and signature. Its also not immediately clear that two OCMs have the same content.
  • We can store the OCM references in an external system. However this requires our systems to talk to both OCI and this external system, making setup more complex.

Approach
The topic was further discussed in community calls and in an additional follow up call. Furthermore, it was already considered in the rewrite of the OCM OCI Storage Backend Specification.
Generally, we agreed on introducing tag support for OCI.

For this, we will start with a optional interface in the bindings/go/oci/interface.go module.

We discussed the following draft (but agreed to look for better names):

type AliasComponentVersionRepository interface {  
    AddComponentVersionAlias(ctx context.Context, component, version string, tag string) error  
    // Remove support will be added later  
    // RemoveComponentVersionAlias(ctx context.Context, component, tag string) error}

The initial scope of this issue is the introduction of this interface only with AddTag support, as well as the corresponding implementation for oci and ctf (both implementation essentially implement oci interfaces and are located in the oci module).

We will set up a follow up issue for delete support as well as for a larger discussion on whether this alias support should be added to the ComponentVersionRepository abstraction as a first class citizen.

Note
Functionally, when working with OCI registry backends, OCM already supports getting component versions by tag, so repo.GetComponentVersion("github.com/acme.org/helloworld", "latest").

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/ipceiImportant Project of Common European Interestkind/featurenew feature, enhancement, improvement, extension

    Type

    No fields configured for Task.

    Projects

    Status
    🍺 Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions