Uploaded image for project: 'OpenShift Bugs'
  1. OpenShift Bugs
  2. OCPBUGS-43356

oc-mirror v2 does not preserve the original digest

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • 4.18.0
    • oc-mirror
    • None
    • CLID Sprint 261
    • 1
    • False
    • Hide

      None

      Show
      None
    • Release Note Not Required
    • In Progress

      Description of problem:

      The digest of an image being mirrored by oc-mirror could change due the compression algorithm being used by the containers/image (go mod used to mirror images in oc-mirror).
      
      Changing the digest could impact oc-mirror a lot since it relies on the digest on several places during the flow (for example, in mirrorToDisk the digest is used to save artifacts that will be consumed in diskToMirror).
      

      Version-Release number of selected component (if applicable):

          

      How reproducible:

      Run MirrorToDisk and DiskToMirror
          

      Steps to Reproduce:

      With the following ImageSetConfiguration:
      
      kind: ImageSetConfiguration
      apiVersion: mirror.openshift.io/v2alpha1
      mirror:
      operators:
       - catalog: registry.redhat.io/redhat/redhat-operator-index@sha256:562445602e026dea6c695e7c551ceb2b1b9f7539c0bde95371b64259d060833b
      packages:
       - name: aws-load-balancer-operator
       - name: 3scale-operator
       - name: node-observability-operator
      
      1 - Run the mirror to disk
      2 - Run the disk to mirror
      

      Actual results:

      2024/10/11 11:51:46  [ERROR]  : open /home/aguidi/go/src/github.com/aguidirh/oc-mirror/alex-tests/clid-247-main/working-dir/operator-images/redhat-operator-index/699ec1f7ad348e14e9f5f3ecb863cb4f5fd885b535d8111aa6c7dbcf0d46825b/index.json: no such file or directory 
      
      Disk to mirror fails because the folder generated inside of the working-dir (during the mirrorToDisk) contains the digest number 562445602e026dea6c695e7c551ceb2b1b9f7539c0bde95371b64259d060833b but due the compression algorithm when calling the PUT in the local registry, the digest 699ec1f7ad348e14e9f5f3ecb863cb4f5fd885b535d8111aa6c7dbcf0d46825b is generated and added. 
      
      During diskToMirror oc-mirror will try to find the folder with the digest of the compression and will not find it since the folder was created with the digest before the compression.
      

      Expected results:

      DiskToMirror should successfully work without errors.
          

      Additional info:

          

            rh-ee-aguidi Alex Guidi
            rh-ee-aguidi Alex Guidi
            ying zhou ying zhou
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: