Bug 1903230

Summary: oc adm catalog mirror does not mirror the catalog image
Product: OpenShift Container Platform Reporter: nathan.brophy
Component: OLMAssignee: Evan Cordell <ecordell>
OLM sub component: OLM QA Contact: Jian Zhang <jiazha>
Status: CLOSED NOTABUG Docs Contact:
Severity: medium    
Priority: medium CC: aos-bugs, dageoffr, dsover, ecordell, jokerman, mfojtik, nhale, rbohne, vdinh
Version: 4.6Keywords: Reopened
Target Milestone: ---   
Target Release: 4.7.0   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-01-06 18:34:52 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 nathan.brophy 2020-12-01 16:48:55 UTC
Description of problem:

oc adm catalog mirror command does not add the source catalog image to the mapping.txt file to mirror to the target location. 

There seem to be related bugs to this opened in bugzilla, but opening again because seeing this on a different version of the oc CLI.

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

$ oc version --client
Client Version: 4.6.6

How reproducible: Always


Steps to Reproduce:
1. Select a source catalog index image
2. Run oc adm catalog mirror <source> <target registry> --manifests-only=true [--filter-by-os]
3. Examine the mapping.txt file produced in the output location, and the <source> catalog index image is not included in the mapping.txt to mirror to the target location.  

Actual results:

Catalog index image used as source is NOT mirrored to target registry.


Expected results:

Catalog index image used as source is successfully mirrored to target registry.

Additional info:

Seeing this on OCP versions 4.5.X and 4.6.0 nightly release build and most recent 4.6.6 build of oc

Comment 1 Robert Bohne 2020-12-02 12:00:04 UTC
From my point of view, this is duplicated to 1890951.

Work-a-round is to add `--filter-by-os='.*'` to oc adm catalog mirror.

Comment 2 Maciej Szulik 2020-12-03 10:30:38 UTC
Agree with Robert here, this is duplicate.

*** This bug has been marked as a duplicate of bug 1890951 ***

Comment 4 Robert Bohne 2020-12-15 07:09:25 UTC
Oh right, my bad.


During the Pruning an index image [1] step the catalog index is pulled from redhat registry and pushed into local registry. Might be useful to add a part into the documentation: how to mirror the full index image with without pruning. Something like
```
oc image mirror registry.redhat.io/redhat/redhat-operator-index:v4.6 <target_registry>:<port>/<namespace>/redhat-operator-index:v4.6 
```

[1] https://docs.openshift.com/container-platform/4.6/operators/admin/olm-restricted-networks.html#olm-pruning-index-image_olm-restricted-networks