Bug 1942059

Summary: `oc adm catalog mirror` doesn't work for the air-gapped cluster
Product: OpenShift Container Platform Reporter: OpenShift BugZilla Robot <openshift-bugzilla-robot>
Component: OLMAssignee: Evan Cordell <ecordell>
OLM sub component: OLM QA Contact: Bruno Andrade <bandrade>
Status: CLOSED ERRATA Docs Contact:
Severity: medium    
Priority: medium CC: akaris, dsover, ecordell, krizza
Version: 4.7Keywords: Triaged
Target Milestone: ---   
Target Release: 4.7.z   
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: 2021-04-05 13:56:42 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1919168, 1990442    
Bug Blocks: 1942818    

Comment 2 Bruno Andrade 2021-03-25 16:56:03 UTC
Use the `oc` client that fixed PR merged for testing.
./oc version -o yaml                                                                                          
clientVersion:
  buildDate: "2021-03-25T06:10:11Z"
  compiler: gc
  gitCommit: d0ceebe24ddf42b022198ef52eeb4e4181112600
  gitTreeState: clean
  gitVersion: 4.7.0-202103250517.p0-d0ceebe
  goVersion: go1.15.7
  major: ""
  minor: ""
  platform: linux/amd64
releaseClientVersion: 4.7.0-0.nightly-2021-03-25-081137

./oc adm catalog mirror quay.io/olmqe/redhat-operator-index:v4.6-2 file:///local/index                        
src image has index label for database path: /database/index.db
using database path mapping: /database/index.db:/tmp/360795679
wrote database to /tmp/360795679
using database at: /tmp/360795679/index.db
<dir>
  local/index/olmqe/redhat-operator-index
  info: Mirroring completed in 1m54.21s (14.32MB/s)
  wrote mirroring manifests to manifests-redhat-operator-index-1616688043

  To upload local images to a registry, run:

  	oc adm catalog mirror file://local/index/olmqe/redhat-operator-index:v4.6-2 REGISTRY/REPOSITORY

2. Check the images mirrored to the local
ls
manifests-redhat-operator-index-1616688043  v2

3. Switch to the parent folder, and tar this folder.
tar -cvf bug1942059.tar bug1942059 
bug1942059/
bug1942059/v2/
bug1942059/v2/local/
bug1942059/v2/local/index/
bug1942059/v2/local/index/olmqe/
bug1942059/v2/local/index/olmqe/redhat-operator-index/
bug1942059/v2/local/index/olmqe/redhat-operator-index/manifests/
bug1942059/v2/local/index/olmqe/redhat-operator-index/manifests/v4.6-2
bug1942059/v2/local/index/olmqe/redhat-operator-index/manifests/sha256:a94e22caf4d1a61c4ebd18d149d03bb4fef155fce457c77c153b501d5d2d7f86
...

4, Copy this tar package to another host. In real env, we should copy it to the Flash-Disk or Portable Hard Disk, and then copy it to the disconnected host.

5, Unzip this tar file.

6, `cd` this folder and mirror the image to the remote registry via `oc adm catalog mirror`
ls bug1942059                   
manifests-redhat-operator-index-1616688043  v2

././oc adm catalog mirror file://local/index/olmqe/redhat-operator-index:v4.6-2 quay.io/bandrade                                                                                                                                   130 ↵
src image has index label for database path: /database/index.db
using database path mapping: /database/index.db:/tmp/898736802
wrote database to /tmp/898736802
using database at: /tmp/898736802/index.db
quay.io/
  bandrade/local-index-olmqe-redhat-operator-index
...
info: Mirroring completed in 19m28.38s (1.39MB/s)

tree manifests-index/
manifests-index/
└── olmqe
    ├── redhat-operator-index-1616689077
    └── redhat-operator-index-1616689133
        ├── catalogSource.yaml
        ├── imageContentSourcePolicy.yaml
        └── mapping.txt

3 directories, 3 files

LGTM, marking as VERIFIED

Comment 5 errata-xmlrpc 2021-04-05 13:56:42 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 (Moderate: OpenShift Container Platform 4.7.5 security and bug fix 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-2021:1005

Comment 6 Anik 2021-06-09 16:33:52 UTC
*** Bug 1942818 has been marked as a duplicate of this bug. ***