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

[v2] oc-mirror v2 Registry credentials are not checked prior to tar unpack when performing disk to mirror action

XMLWordPrintable

    • Quality / Stability / Reliability
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • x86_64
    • None
    • None
    • None
    • CLID Sprint 277
    • 1
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Description of problem:

      When performing disk to mirror operation using `oc-mirror` the tar gets processed before `oc-mirror` attempts to connect to the destination registry. With large tar files this unpack process can take a long time. This time is wasted if `oc-mirror` is unable to connect to the target registry as the unpack has to occur again after the user has logged into the registry.    

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

      Client Version: version.Info{Major:"", Minor:"", EmulationMajor:"", EmulationMinor:"", MinCompatibilityMajor:"", MinCompatibilityMinor:"", GitVersion:"4.20.0-202507271558.p2.ga71b6b0.assembly.stream.el9-a71b6b0", GitCommit:"a71b6b0d7b39365bc29463fab21f3c6be2c855c1", GitTreeState:"clean", BuildDate:"2025-07-27T16:25:30Z", GoVersion:"go1.24.4 (Red Hat 1.24.4-2.el9) X:strictfipsruntime", Compiler:"gc", Platform:"linux/amd64"}

      How reproducible:

          Always

      Steps to Reproduce:

          1. Create your tar file using the mirror to disk process
          2. Optionally move your tar file to your disconnected host
          3. Without logging into your destination mirror, run the disk to mirror operation
          `oc-mirror --v2 -c imageset-config.yaml --from file://mirror1 docker://$(hostname):8443`     

      Actual results:

      [ec2-user@registry ~]$ oc-mirror --v2 -c imageset-config.yaml --from file://mirror1 docker://$(hostname):8443
      2025/08/26 18:46:39  [INFO]   : 👋 Hello, welcome to oc-mirror
      2025/08/26 18:46:39  [INFO]   : ⚙️  setting up the environment for you...
      2025/08/26 18:46:39  [INFO]   : 🔀 workflow mode: diskToMirror 
      2025/08/26 18:46:39  [INFO]   : 📦 Extracting mirror archive(s)...
      mirror1/mirror_000001.tar (25.9 GiB / 25.9 GiB) [=====================================================================================================================] 6m49s
      2025/08/26 18:53:29  [INFO]   : 🕵  going to discover the necessary images...
      2025/08/26 18:53:29  [INFO]   : 🔍 collecting release images...
      2025/08/26 18:53:29  [INFO]   : 🔍 collecting operator images...
       ✓   () Collecting catalog registry.redhat.io/redhat/redhat-operator-index:v4.18 
      2025/08/26 18:53:29  [INFO]   : 🔍 collecting additional images...
      2025/08/26 18:53:29  [INFO]   : 🔍 collecting helm images...
      2025/08/26 18:53:29  [INFO]   : 🚀 Start copying the images...
      2025/08/26 18:53:29  [INFO]   : 📌 images to copy 196 
      0 / 196 (0s) [----------------------------------------------------------------------------------------------------------------------------------------------------------] 0 %
       ✗   () ocp-v4.0-art-dev@sha256:04b340433c0ebf32b35d7cbbab5ce79dd2d201b9d54e552b049251805c6bf4b9 ➡️  registry.sandbox1525.opentlc.com:8443/openshift/ 
       ✗   (0s) ocp-v4.0-art-dev@sha256:01f3130bf53c8d0b512f2780489b21f2e0d095c6190b92eb70f22137cbb6441d ➡️  registry.sandbox1525.opentlc.com:8443/openshift/ 
       ✗   (0s) ocp-v4.0-art-dev@sha256:01cf299e9dfb5ea4b62eb24e7bd6341e2cc4ebd3f7e7e0f95901ed25d283dc34 ➡️  registry.sandbox1525.opentlc.com:8443/openshift/ 
       ✗   (0s) ocp-v4.0-art-dev@sha256:01ba76c136857f2e2db1fa2eb13b158dd8c4b2b68c373419760fe94729377c3c ➡️  registry.sandbox1525.opentlc.com:8443/openshift/ 
       ✗   (0s) ocp-v4.0-art-dev@sha256:005d390935d33aaa4e8a29b3325c43a7511fe7cb0c554a0bd3a29811851bb2db ➡️  registry.sandbox1525.opentlc.com:8443/openshift/ 
       ✗   (0s) ocp-v4.0-art-dev@sha256:026ab15a28cc7718d2183a20ce6e43ce4bf7a9e0f05508ef71d67bb5ffa4251d ➡️  registry.sandbox1525.opentlc.com:8443/openshift/ 
      2025/08/26 18:53:30  [INFO]   : === Results ===
      2025/08/26 18:53:30  [INFO]   :  ✗  0 / 190 release images mirrored: Some release images failed to be mirrored - please check the logs
      2025/08/26 18:53:30  [INFO]   :  ✗  0 / 5 operator images mirrored: Some operator images failed to be mirrored - please check the logs
      2025/08/26 18:53:30  [INFO]   :  ✗  0 / 1 additional images mirrored: Some additional images failed to be mirrored - please check the logs
      2025/08/26 18:53:30  [ERROR]  : [Worker] error mirroring image quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:01ba76c136857f2e2db1fa2eb13b158dd8c4b2b68c373419760fe94729377c3c error: trying to reuse blob sha256:25c75c34b2e2b68ba9245d9cddeb6b8a0887371ed30744064f85241a75704d87 at destination: checking whether a blob sha256:25c75c34b2e2b68ba9245d9cddeb6b8a0887371ed30744064f85241a75704d87 exists in registry.sandbox1525.opentlc.com:8443/openshift/release: authentication required
      2025/08/26 18:53:30  [INFO]   : 📄 Nothing mirrored. Skipping IDMS and ITMS files generation.
      2025/08/26 18:53:30  [INFO]   : 📄 Generating UpdateService file...
      2025/08/26 18:53:30  [INFO]   : mirror1/working-dir/cluster-resources/updateService.yaml file created
      2025/08/26 18:53:30  [INFO]   : mirror time     : 6m51.060788375s
      2025/08/26 18:53:30  [INFO]   : 👋 Goodbye, thank you for using oc-mirror
      2025/08/26 18:53:30  [ERROR]  : [Executor] [Worker] some errors occurred during the mirroring.
           Please review mirror1/working-dir/logs/mirroring_errors_20250826_185330.txt for a list of mirroring errors.
           You may consider:
           * removing images or operators that cause the error from the image set config, and retrying
           * keeping the image set config (images are mandatory for you), and retrying
           * mirroring the failing images manually, if retries also fail.

      Expected results:

      Credentials are validated prior to unpacking the tar saving 7m in this example with only platform and web-terminal images.

      Additional info:

      kind: ImageSetConfiguration
      apiVersion: mirror.openshift.io/v1alpha2
      mirror:
        platform:
          channels:
          - name: stable-4.18
            minVersion: 4.18.17
            maxVersion: 4.18.17 
          graph: true
        operators:
          - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.18
            packages:
              - name: web-terminal
        additionalImages: 
          - name: registry.redhat.io/ubi9/ubi:latest    

              rh-ee-aguidi Alex Guidi
              rhn-gps-jmcdade Joseph McDade (Inactive)
              Joseph McDade (Inactive)
              None
              Nidan Gavali Nidan Gavali
              None
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: