Bug 2087764

Summary: Rewrite the registry backend will hit error
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: medium    
Priority: medium 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:12:53 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-18 13:08:20 UTC
Description of problem:
Rewrite the registry backend will hit error

Version-Release number of selected component (if applicable):
oc-mirror version 
Client Version: version.Info{Major:"", Minor:"", GitVersion:"4.11.0-202205131159.p0.g7bde4c7.assembly.stream-7bde4c7", GitCommit:"7bde4c7bde6b829a34592b2d12115fb38b15576f", GitTreeState:"clean", BuildDate:"2022-05-13T12:59:14Z", GoVersion:"go1.18", Compiler:"gc", Platform:"linux/amd64"}


How reproducible:
always

Steps to Reproduce:
1.Use following config to run mirror2mirror operator package command first time :
cat setting.yaml 
kind: ImageSetConfiguration
apiVersion: mirror.openshift.io/v1alpha2
storageConfig:
  registry:
    skipTLS: false
    imageURL: xxxxx.us-east-2.compute.amazonaws.com:5000/test2:latest
mirror:
  operators:
  - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.11
    packages:
    - name: cluster-logging
      minVersion: '5.4.1-24'
      channels:
      - name: stable

`oc-mirror --config setting.yaml  docker://xxxxx.us-east-2.compute.amazonaws.com:5000/operatortest`

2.Used the same config and run the mirror2mirror operator package command second time but only change the projectname :
`oc-mirror --config setting.yaml  docker://xxxxx.us-east-2.compute.amazonaws.com:5000/operatortest11`

3.

Actual results:
1. Mirror succeed;
2. Command failed with error:
oc-mirror --config setting.yaml  docker://xxxxxx.us-east-2.compute.amazonaws.com:5000/operatortest11
Checking push permissions for xxxxx.us-east-2.compute.amazonaws.com:5000
Found: oc-mirror-workspace/src/publish
Found: oc-mirror-workspace/src/v2
Found: oc-mirror-workspace/src/charts
error: error updating include config: invalid index:
└── invalid package "cluster-logging":
    ├── invalid channel "stable-5.2":
    │   └── channel must contain at least one bundle
    └── invalid channel "stable-5.3":
        └── channel must contain at least one bundle



Expected results:
2. If can’t rewrite the registry backend information please give more clearly prompt massage 


Additional info:

Comment 1 Jennifer Power 2022-05-18 13:22:51 UTC
@yinzhou The root of this error may have more to do with the configuration and less with the rewrite of the target registry namespace. Although, you are right about making sure it is more clear that rewriting the namespace on a mirror to mirror differential run can have unexpected behavior. @aflom submitted another BZ to describe that issue. https://bugzilla.redhat.com/show_bug.cgi?id=2087271. I will investigate why this configuration is not always seen as valid.

Comment 2 Jennifer Power 2022-05-18 16:23:05 UTC
An update:

This issue arises when using this configuration with full = true.
kind: ImageSetConfiguration
apiVersion: mirror.openshift.io/v1alpha2
storageConfig:
  registry:
    skipTLS: false
    imageURL: localhost:5001/test2:latest
mirror:
  operators:
  - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.10
    full: true
    packages:
    - name: cluster-logging
      minVersion: '5.4.1-24'

This reason this appears only during a differential run of oc-mirror, is this operation is implicitly run. If full is true in the configuration this issue will appear is 100% reproducible whether it is the first run and a differential run. We have identified this as a regression in the operator-registry diff library.

Comment 4 zhou ying 2022-05-25 02:29:36 UTC
can't reproduced with latest version :

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"}

when run the second time :

oc-mirror --config setting.yaml docker://localhost:5000/testrr  --dest-use-http
Checking push permissions for localhost:5000
Found: oc-mirror-workspace/src/publish
Found: oc-mirror-workspace/src/v2
Found: oc-mirror-workspace/src/charts
WARN[0031] 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. 
wrote mirroring manifests to oc-mirror-workspace/operators.1653445512/manifests-redhat-operator-index

To upload local images to a registry, run:

	oc adm catalog mirror file://redhat/redhat-operator-index:v4.10 REGISTRY/REPOSITORY
no new images detected, process stopping

Comment 6 errata-xmlrpc 2022-08-10 11:12:53 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