Skip to content

Missing digest information for copied-by-value OCI images #34

Description

@lukasgr90

What happened:

ocm-kit did not provide the digest of an OCI image, which was copied by value into an OCI registry (as field Digest to the value mapping template render process).

What you expected to happen:

ocm-kit provides the digest of OCI image resources to the value mapping template rendering.

How to reproduce it (as minimally and precisely as possible):

I use following simple values mapping values.yaml.tpl:

image:
    {{- $traefikImage := index .OCIResources "traefik-image" }}
    registry: {{ $traefikImage.Host }}
    repository: {{ $traefikImage.Repository }}
    tag: {{ $traefikImage.Tag }}@{{ $traefikImage.Digest }}

and following component constructor component-constructor.yaml:

name: example.org/traefik
version: 3.6.25
provider:
  name: Team
resources:
  - name: helm-chart
    type: helmChart
    version: 39.0.7
    relation: external
    access:
      type: OCIImage/v1
      imageReference: "ghcr.io/traefik/helm/traefik:39.0.7"
  - name: traefik-image
    type: ociImage
    version: 3.6.11
    relation: external
    access:
      type: OCIImage/v1
      imageReference: "ghcr.io/traefik/traefik:3.6.25@sha256:31267173a15b4944e797a76ffd9c419707c8d8b32fe5b610f80cd0cfa05f372d"
  - name: helm-values-template
    type: yaml
    labels:
      - name: "ext.ocm.software/helm.values-for"
        value: helm-chart
    relation: local
    input:
      type: File/v1
      path: values.yaml.tpl
      mediaType: application/x-yaml

Now I add the example component version my local OCI registry (listening on localhost:5000):

🐸💻 ~/bin/ocmv2 add cv --repository ctf::test.ctf -c component-constructor.yaml --component-version-conflict-policy replace
[...]
 COMPONENT           │ VERSION │ PROVIDER 
─────────────────────┼─────────┼──────────
 example.org/traefik │ 3.6.25  │ Team
🐸💻 ~/bin/ocmv2 transfer cv -r --copy-resources ctf::./test.ctf//example.org/traefik oci::http://localhost:5000/test
[...]
🐸💻 ~/bin/ocmv2 transfer cv -r --copy-resources ctf::./test.ctf//example.org/traefik oci::http://localhost:5000/test
✓ Resolving component versions...
[...]
✓ Transferring component versions...
    ✓ transformExampleOrgTraefik3625AddtransformTraefikImage3611 [OCIAddLocalResource]
    ✓ transformExampleOrgTraefik3625AddtransformHelmValuesTemplate3625 [OCIAddLocalResource]
    ✓ transformExampleOrgTraefik3625Upload [OCIAddComponentVersion]
    ✓ fileBufferCleanup [FileCleanup]
  [████████████████████████████████████████] 100% 8/8

Now I use the ocm-kit cmd helper:

🐸💻 ~/Development/community/ocm-kit/ocm-kit http://localhost:5000/test//example.org/traefik:3.6.25
image:
    registry: localhost:5000
    repository: test/traefik/traefik
    tag: 3.6.25@

=> No digest at the end of the tag.

Anything else we need to know:

If I skip the copy-by-value, e.g. by adding the CV to my local registry directly, the Digest is populated as expected:

🐸💻 ~/bin/ocmv2 add cv --repository oci::http://localhost:5000/test -c component-constructor.yaml --component-version-conflict-policy replace
[...]
 COMPONENT           │ VERSION │ PROVIDER 
─────────────────────┼─────────┼──────────
 example.org/traefik │ 3.6.25  │ Team     
🐸💻 ~/Development/community/ocm-kit/ocm-kit http://localhost:5000/test//example.org/traefik:3.6.25
image:
    registry: ghcr.io
    repository: traefik/traefik
    tag: 3.6.25@sha256:31267173a15b4944e797a76ffd9c419707c8d8b32fe5b610f80cd0cfa05f372d

Environment:

  • Nixos 26.05
  • ocm-kit build based on commit "3b866d48da741488e4307d66de120e90bc11b503"
  • ocm(v2) CLI based on commit "eb3e97667b61e5193f998514465486579cba9d97"
  • Empty OCM configuration
  • Zot v2.1.15 as OCI registry

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions