Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 2090092

Summary: Will hit error if specify the channel not the latest
Product: OpenShift Container Platform Reporter: zhou ying <yinzhou>
Component: ocAssignee: Alex <aflom>
oc sub component: oc-mirror QA Contact: zhou ying <yinzhou>
Status: CLOSED ERRATA Docs Contact:
Severity: high    
Priority: high CC: jpower, vdinh
Version: 4.11   
Target Milestone: ---   
Target Release: 4.11.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-08-10 11:14:09 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description zhou ying 2022-05-25 06:43:51 UTC
Description of problem:
Will hit error if specify the channel not the latest

Version-Release number of selected component (if applicable):
oc-mirror version 
Client Version: version.Info{Major:"", Minor:"", GitVersion:"4.11.0-202205192208.p0.gf93ddac.assembly.stream-f93ddac", GitCommit:"f93ddac651dbdd9e3092d79b744df8d3b32c8ea4", GitTreeState:"clean", BuildDate:"2022-05-19T22:34:11Z", GoVersion:"go1.18", Compiler:"gc", Platform:"linux/amd64"}


How reproducible:
always

Steps to Reproduce:
1. List channel for package :
`oc-mirror list operators --catalog=registry.redhat.io/redhat/redhat-operator-index:v4.10  --package=quay-operator`
PACKAGE        CHANNEL     HEAD
quay-operator  quay-v3.4   quay-operator.v3.4.7
quay-operator  quay-v3.5   quay-operator.v3.5.7
quay-operator  stable-3.6  quay-operator.v3.6.6
quay-operator  stable-3.7  quay-operator.v3.7.0

2. Specify channel except the latest as following :
cat seting.yaml 
apiVersion: mirror.openshift.io/v1alpha2
kind: ImageSetConfiguration
storageConfig:
  local:
    path: /home/ocmirrortest/newverify
mirror:
  operators:
    - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.10
      packages:
        - name: quay-operator
          channels:
          - name: quay-v3.4
3. Run the mrror command :
`oc-mirror --config seting.yaml file:// --dry-run`


Actual results:
3. The mirror command will failed with error:
oc-mirror --config seting.yaml file:// --dry-run 
Found: oc-mirror-workspace/src/publish
Found: oc-mirror-workspace/src/v2
Found: oc-mirror-workspace/src/charts
No metadata detected, creating new workspace
WARN[0040] DEPRECATION NOTICE:
Sqlite-based catalogs and their related subcommands are deprecated. Support for
them will be removed in a future release. Please migrate your catalog workflows
to the new file-based catalog format. 
error: error converting declarative config to include config: invalid index:
└── invalid package "quay-operator":
    └── invalid channel "stable-3.7":
        └── channel must contain at least one bundle


Expected results:
No error , and mirror  the specified package . 


Additional info:
when specify with latest channel stable-3.7 without this error.

Comment 1 Jennifer Power 2022-05-25 14:55:46 UTC
Just to add a bit of background here. In the short term, this issue would have to be handled by documentation. 
We do, however, have a PR to add slightly more context to this error. This issue being seen is that the default channel of the quay operator is being filtered from the index resulting in an invalid index. So an error is expected here. We have an open request to handle the default channel a bit differently but that would be more of a feature https://github.com/openshift/oc-mirror/issues/453. I think something that might also help is having default channel information as an output in the `oc-mirror list operator` command.

Comment 3 Jennifer Power 2022-06-07 19:22:43 UTC
@yinzhou the linked PR would not satisfy your acceptance criteria because the configuration passed to oc-mirror is not valid per OLM constraints. Changes that were made were to allow a user to view the default channel for the package by running "oc-mirror list operators --catalog CATALOG --package PACKAGE". Not sure if that would qualify to move this into the verified, but the request to handle the default channel is being tracked in the "operator-registry" upstream repository as an enhancement at https://github.com/operator-framework/operator-registry/pull/969.

Comment 4 zhou ying 2022-06-10 03:23:45 UTC
oc-mirror list operators  --catalog=registry.redhat.io/redhat/redhat-operator-index:v4.11 --package=rhsso-operator
NAME            DISPLAY NAME                     DEFAULT CHANNEL
rhsso-operator  Red Hat Single Sign-On Operator  stable

PACKAGE         CHANNEL  HEAD
rhsso-operator  alpha    rhsso-operator.7.5.1-opr-005
rhsso-operator  stable   rhsso-operator.7.5.2-opr-002




oc-mirror version 
Client Version: version.Info{Major:"", Minor:"", GitVersion:"4.11.0-202206090038.p0.g49a4f17.assembly.stream-49a4f17", GitCommit:"49a4f1789993d90dc9763cb527a57fd70f9ae0e9", GitTreeState:"clean", BuildDate:"2022-06-09T01:20:22Z", GoVersion:"go1.18", Compiler:"gc", Platform:"linux/amd64"}

Comment 6 errata-xmlrpc 2022-08-10 11:14:09 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Important: OpenShift Container Platform 4.11.0 bug fix and security update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:5069