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

oc-mirror does not stop and return a valid error code when mirroring fails

XMLWordPrintable

    • No
    • False
    • Hide

      None

      Show
      None

      This is a clone of issue OCPBUGS-23003. The following is the description of the original issue:

      Description of problem:
      An error during the execution (as seen in the log with the message 'Operator cluster-logging was not found'), the return code ($?) after running oc-mirror indicates success (returning 0). It should stop its execution and return a valid error code.

       

      ERRO[0043] Operator cluster-logging was not found, please check name, minVersion, maxVersion, and channels in the config file.

      Version-Release number of selected component:

       

      Client Version: version.Info{Major:"", Minor:"", GitVersion:"4.14.0-202310201027.p0.g68cf97e.assembly.stream-68cf97e", GitCommit:"68cf97ec715ad2d78fb2bac411a118709c191719", GitTreeState:"clean", BuildDate:"2023-10-20T23:48:14Z", GoVersion:"go1.20.10 X:strictfipsruntime", Compiler:"gc", Platform:"linux/amd64"}
      

      How reproduce:

      Use this imageset configuration imageset.yaml file:

       

      ---
      apiVersion: mirror.openshift.io/v1alpha2
      kind: ImageSetConfiguration
      mirror:
        operators:
          - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.14
            targetName: redhat-operator-index
            targetTag: v4.14-n2-tst1
            packages:
              - {'name': 'cincinnati-operator', 'channels': [{'name': 'v1', 'minVersion': '5.0.2', 'maxVersion': '5.0.2'}]}
              - {'name': 'cluster-logging', 'channels': [{'name': 'stable', 'minVersion': '5.7.7', 'maxVersion': '5.7.7'}]}

       

      And process:

      $ oc-mirror --config imageset.yaml file://archive
      

       

      Actual results:

      [root@lab]# oc-mirror --config imageset.yaml file://archive
      Logging to .oc-mirror.log
      Creating directory: archive/oc-mirror-workspace/src/publish
      Creating directory: archive/oc-mirror-workspace/src/v2
      Creating directory: archive/oc-mirror-workspace/src/charts
      Creating directory: archive/oc-mirror-workspace/src/release-signatures
      backend is not configured in imageset.yaml, using stateless mode
      backend is not configured in imageset.yaml, using stateless mode
      No metadata detected, creating new workspace
      ERRO[0043] Operator cluster-logging was not found, please check name, minVersion, maxVersion, and channels in the config file. 
      wrote mirroring manifests to archive/oc-mirror-workspace/operators.1698995403/manifests-redhat-operator-indexTo upload local images to a registry, run:        oc adm catalog mirror file://redhat/redhat-operator-index:v4.14 REGISTRY/REPOSITORY
      <dir>
        openshift-update-service/cincinnati-operator-bundle
          blobs:
            registry.redhat.io/openshift-update-service/cincinnati-operator-bundle sha256:1e4db847133e7d28ddbc406e10f64a534bfddedefe0e393ae03f5c0a8cb51b35 6.565KiB
            registry.redhat.io/openshift-update-service/cincinnati-operator-bundle sha256:fbeb270e117022631b7b04f3f45c89b5a623507cfc6fd178a8d0ee04df381b16 7.268KiB
          manifests:
            sha256:9c57110894fddd6cab86c06ee3d3c26fc8330146f8204b28edd544745879d170 -> a66a51ea
        openshift-update-service/openshift-update-service-rhel8
          blobs:
            registry.redhat.io/openshift-update-service/openshift-update-service-rhel8 sha256:b742f6a70c512b5028afd6a0d33ebe18383eb8d6cf171df818207d9738d2e1c0 9.992KiB
            registry.redhat.io/openshift-update-service/openshift-update-service-rhel8 sha256:adf03c6b66b6f1ca3dac6bfd26dccc64b21d47cb0dea93c1d0651e5d06f2612b 15.86MiB
            registry.redhat.io/openshift-update-service/openshift-update-service-rhel8 sha256:dc35b837139a95d1b9f7f7b0435a024a74ab972416bdc248f3f608c9f917a753 37.49MiB
          manifests:
            sha256:31f7739ba0df2bddaa4cc7bebf74ac7f339250a7b8e00f6883100ccff75f8225
            sha256:cde71a688ae7cad850e01ac05d916066c4ba9d9707d0489a217c3c94f77151ed
            sha256:31f7739ba0df2bddaa4cc7bebf74ac7f339250a7b8e00f6883100ccff75f8225 -> 5e1277e0
        openshift-update-service/openshift-update-service-rhel8-operator
          blobs:
            registry.redhat.io/openshift-update-service/openshift-update-service-rhel8-operator sha256:a9f9c1ddba3f4adcc7a2f56b0fe262d954de96038fd822a2fad3351cad33a38d 12.32KiB
            registry.redhat.io/openshift-update-service/openshift-update-service-rhel8-operator sha256:cc4a475e6d53fffe0b36626406575e88a30a419b174b513f22bfc4a0cc148d94 11.05MiB
            registry.redhat.io/openshift-update-service/openshift-update-service-rhel8-operator sha256:dc35b837139a95d1b9f7f7b0435a024a74ab972416bdc248f3f608c9f917a753 37.49MiB
          manifests:
            sha256:2dd3e75d3b57e29ace0bb8e87ddf2cbef4a2b05656ab6e05ebcdfa6c517f13e6
            sha256:d8fc9349b63465990695bb99373e00974ebbe5e9a2ad585f77cd1ff8dd552a7d
            sha256:d8fc9349b63465990695bb99373e00974ebbe5e9a2ad585f77cd1ff8dd552a7d -> 829fb60f
        stats: shared=1 unique=6 size=64.43MiB ratio=0.42phase 0:
         openshift-update-service/cincinnati-operator-bundle     blobs=2 mounts=0 manifests=1 shared=0
         openshift-update-service/openshift-update-service-rhel8 blobs=3 mounts=0 manifests=3 shared=1
      phase 1:
         openshift-update-service/openshift-update-service-rhel8-operator blobs=3 mounts=1 manifests=3 shared=1info: Planning completed in 1.02s
      sha256:9c57110894fddd6cab86c06ee3d3c26fc8330146f8204b28edd544745879d170 file://openshift-update-service/cincinnati-operator-bundle:a66a51ea
      uploading: file://openshift-update-service/openshift-update-service-rhel8 sha256:adf03c6b66b6f1ca3dac6bfd26dccc64b21d47cb0dea93c1d0651e5d06f2612b 15.86MiB
      uploading: file://openshift-update-service/openshift-update-service-rhel8 sha256:dc35b837139a95d1b9f7f7b0435a024a74ab972416bdc248f3f608c9f917a753 37.49MiB
      sha256:cde71a688ae7cad850e01ac05d916066c4ba9d9707d0489a217c3c94f77151ed file://openshift-update-service/openshift-update-service-rhel8
      sha256:31f7739ba0df2bddaa4cc7bebf74ac7f339250a7b8e00f6883100ccff75f8225 file://openshift-update-service/openshift-update-service-rhel8:5e1277e0
      mounted: file://openshift-update-service/openshift-update-service-rhel8-operator sha256:dc35b837139a95d1b9f7f7b0435a024a74ab972416bdc248f3f608c9f917a753 37.49MiB
      uploading: file://openshift-update-service/openshift-update-service-rhel8-operator sha256:cc4a475e6d53fffe0b36626406575e88a30a419b174b513f22bfc4a0cc148d94 11.05MiB
      sha256:2dd3e75d3b57e29ace0bb8e87ddf2cbef4a2b05656ab6e05ebcdfa6c517f13e6 file://openshift-update-service/openshift-update-service-rhel8-operator
      sha256:d8fc9349b63465990695bb99373e00974ebbe5e9a2ad585f77cd1ff8dd552a7d file://openshift-update-service/openshift-update-service-rhel8-operator:829fb60f
      info: Mirroring completed in 1.69s (39.97MB/s)
      Creating archive /mnt/vol/ocp/redhat-operator/q/archive/mirror_seq1_000000.tar
      [root@lab]# echo $?
      0

      Expected results:
      When there is an error the oc-mirror should stop and return a valid error code.

      Additional info:
      Our strong opinion is that this is an error, and the mirroring process must be stopped and oc-mirror must return an error code. If the mirroring process does not produce - for whatever reason - the operator set defined in imagesetconfiguration, that must be considered as an error, and the return status must be set accordingly.

      We already faced this issue: mirroring was incomplete (due to an incorrect operator version configured in imagesetconfiguration), but it passed the CI and thus ended to build... All this happened because oc-mirror didn't exit with an error status.

      If someone wishes to ignore errors, there's already an option available for that:

      --continue-on-error               If an error occurs, keep going and attempt to complete operations if possible

              luzuccar@redhat.com Luigi Mario Zuccarelli
              openshift-crt-jira-prow OpenShift Prow Bot
              ying zhou ying zhou
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: