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

oc-mirror v2 should validate ImageSetConfiguration to reject duplicate YAML keys

XMLWordPrintable

    • Quality / Stability / Reliability
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • None
    • CLID Sprint 278
    • 1
    • In Progress
    • Release Note Not Required
    • N/A
    • None
    • None
    • None
    • None

      Description of problem:

      When an ImageSetConfiguration contains duplicate top-level keys (e.g., two mirror: blocks), oc-mirror v2 parses the file without any error. The YAML parser (sigs.k8s.io/yaml) silently discards earlier keys and only applies the last one.
      This results in misleading success output while portions of the configuration are ignored. For example, a platform section can be dropped entirely if followed by another mirror: section defining operators.    

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

          

      How reproducible:

          

      Steps to Reproduce:

          1. Create an imageset.yaml with two mirror: blocks:
      
      kind: ImageSetConfiguration
      apiVersion: mirror.openshift.io/v2alpha1
      mirror:
        platform:
          channels:
            - name: stable-4.18
              minVersion: 4.18.20
              maxVersion: 4.18.21
          graph: truemirror:
        operators:
          - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.18
            packages:
              - name: metallb
        additionalImages:
          - name: registry.redhat.io/ubi8/ubi:latest
      
      2. Run oc mirror.
      3. The command completes successfully.
      4. Only the operators and additionalImages are mirrored; the platform images are silently ignored.     

      Actual results:

      oc mirror runs successfully without warnings or errors.
      Only the last mirror: block is honored.
      Earlier sections (e.g., platform) are silently dropped.    

      Expected results:

      oc mirror should fail fast with a clear validation error.
      Duplicate top-level keys in ImageSetConfiguration should be rejected.
      Schema validation should enforce correctness of the configuration before mirroring begins.    

      Additional info:

          

              rdossant Rafael Fonseca dos Santos
              rhn-support-chdeshpa Chinmay Deshpande
              None
              None
              Nidan Gavali Nidan Gavali
              None
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: