Description of problem: When mirroring a pruned image for a restricted (airgap) cluster, oc adm catalog fails due to what seems like invalid path assumptions from tool. [quicklab@master-0 mirror]$ oc adm catalog mirror file://local/index/mirror-ocp4/redhat-operator-index:v4.6 localhost:5000/mirror-ocp4 --insecure -a ../pullsecret src image has index label for database path: /database/index.db using database path mapping: /database/index.db:/tmp/982262084 wrote database to /tmp/982262084 using database at: /tmp/982262084/index.db localhost:5000/ mirror-ocp4/local-index-mirror-ocp4-redhat-operator-index blobs: file://local/index/mirror-ocp4/redhat-operator-index sha256:74578e827b487178665e59cec95e17e6ff4bf6b996d8f3e508ddeffc3bfc4791 168B file://local/index/mirror-ocp4/redhat-operator-index sha256:572c5addd5bf044b6b734ce40380d032464410a096b6f0a82340f8149fd66ab6 3.475KiB file://local/index/mirror-ocp4/redhat-operator-index sha256:ffaff33cc5a472577be22b5ed0aa68ff11d97811f559f1258533f69c9e3c4a5d 2.169MiB file://local/index/mirror-ocp4/redhat-operator-index sha256:74782b667c7d97370a22aec902de10a0acbf19e545f0a770e1b7e37ab2b84774 2.766MiB file://local/index/mirror-ocp4/redhat-operator-index sha256:d793bf0b9363390be5ee2cf6f706c004378e848d741f4269b253b95146154e73 3.746MiB file://local/index/mirror-ocp4/redhat-operator-index sha256:f123f899a38e425da3487231bf5b60f19e0c5eed474aecd296c2f89abeb833c7 6.989MiB file://local/index/mirror-ocp4/redhat-operator-index sha256:5c1f3e8353d28d2f97a97304ee7ef8dc4d7bc4d028667ac20416fde26863b5f8 14.8MiB manifests: sha256:3f26884df7bb51fde3e5f9dd25477934b340d1c8f22aae253ba409658433eee4 -> v4.6 stats: shared=0 unique=7 size=30.47MiB ratio=1.00 error: unable to retrieve source image file://local/index/mirror-ocp4/redhat-operator-index/openshift4/ose-cluster-logging-operator manifest sha256:5aa8966f31e224cbd312c4058cec33805a0d66361eb79460823dbe453f791a76: open v2/local/index/mirror-ocp4/redhat-operator-index/openshift4/ose-cluster-logging-operator/manifests/sha256:5aa8966f31e224cbd312c4058cec33805a0d66361eb79460823dbe453f791a76: no such file or directory error: unable to retrieve source image file://local/index/mirror-ocp4/redhat-operator-index/openshift4/ose-logging-fluentd manifest sha256:0e9b0002ea177e80861f5a8517ccf62e05535d6e4a4d48a905e6b329865e4229: open v2/local/index/mirror-ocp4/redhat-operator-index/openshift4/ose-logging-fluentd/manifests/sha256:0e9b0002ea177e80861f5a8517ccf62e05535d6e4a4d48a905e6b329865e4229: no such file or directory error: unable to retrieve source image file://local/index/mirror-ocp4/redhat-operator-index/openshift4/ose-cluster-logging-operator-bundle manifest sha256:d52c96ee7197c9958501388258fd4a20f7c3ff243ce9e8d93503bcdbccc09c1c: open v2/local/index/mirror-ocp4/redhat-operator-index/openshift4/ose-cluster-logging-operator-bundle/manifests/sha256:d52c96ee7197c9958501388258fd4a20f7c3ff243ce9e8d93503bcdbccc09c1c: no such file or directory error: unable to retrieve source image file://local/index/mirror-ocp4/redhat-operator-index/openshift4/ose-logging-curator5 manifest sha256:fccd7bb4bc56f31503c34dba25e99095747a1ee42c353b4279635e759a1b7685: open v2/local/index/mirror-ocp4/redhat-operator-index/openshift4/ose-logging-curator5/manifests/sha256:fccd7bb4bc56f31503c34dba25e99095747a1ee42c353b4279635e759a1b7685: no such file or directory phase 0: localhost:5000 mirror-ocp4/local-index-mirror-ocp4-redhat-operator-index blobs=7 mounts=0 manifests=1 shared=0 info: Planning completed in 10ms uploading: localhost:5000/mirror-ocp4/local-index-mirror-ocp4-redhat-operator-index sha256:d793bf0b9363390be5ee2cf6f706c004378e848d741f4269b253b95146154e73 3.746MiB uploading: localhost:5000/mirror-ocp4/local-index-mirror-ocp4-redhat-operator-index sha256:f123f899a38e425da3487231bf5b60f19e0c5eed474aecd296c2f89abeb833c7 6.989MiB uploading: localhost:5000/mirror-ocp4/local-index-mirror-ocp4-redhat-operator-index sha256:5c1f3e8353d28d2f97a97304ee7ef8dc4d7bc4d028667ac20416fde26863b5f8 14.8MiB uploading: localhost:5000/mirror-ocp4/local-index-mirror-ocp4-redhat-operator-index sha256:74782b667c7d97370a22aec902de10a0acbf19e545f0a770e1b7e37ab2b84774 2.766MiB uploading: localhost:5000/mirror-ocp4/local-index-mirror-ocp4-redhat-operator-index sha256:ffaff33cc5a472577be22b5ed0aa68ff11d97811f559f1258533f69c9e3c4a5d 2.169MiB sha256:3f26884df7bb51fde3e5f9dd25477934b340d1c8f22aae253ba409658433eee4 localhost:5000/mirror-ocp4/local-index-mirror-ocp4-redhat-operator-index:v4.6 info: Mirroring completed in 680ms (46.86MB/s) error mirroring image: one or more errors occurred no digest mapping available for file://local/index/mirror-ocp4/redhat-operator-index:v4.6, skip writing to ImageContentSourcePolicy wrote mirroring manifests to manifests-index/mirror-ocp4/redhat-operator-index-1624035924 For some reason, the normal artifacts of the various operator images were downloaded w/ their original paths into the file:// location; however, when attempting to upload them into the mirror registry, it is appending their original locations to the location of the pruned image. Example: error: unable to retrieve source image file://local/index/mirror-ocp4/redhat-operator-index/openshift4/ose-logging-curator5 manifest sha256:fccd7bb4bc56f31503c34dba25e99095747a1ee42c353b4279635e759a1b7685: open v2/local/index/mirror-ocp4/redhat-operator-index/openshift4/ose-logging-curator5/manifests/sha256:fccd7bb4bc56f31503c34dba25e99095747a1ee42c353b4279635e759a1b7685: no such file or directory Here you can see that openshift4/ose-logging-curator5 which is the correct path under v2 is being appended to the namespace of the index mirror-ocp4/redhat-operator-index. Version-Release number of selected component (if applicable): oc client 4.6.0-202105290217.p0.git.5ab7b2b-5ab7b2b opm {OpmVersion:"v1.14.3-34-gd0b49148", GitCommit:"d0b49148a4f476f1403c7b8fd262173789009484", BuildDate:"2021-05-29T03:52:37Z", GoOs:"linux", GoArch:"amd64"} How reproducible: always Steps to Reproduce: 1. Create local registry podman pull docker.io/registry podman run -d -p 5000:5000 --restart always --name registry registry:2 2. Create pruned catalog opm index prune -f registry.redhat.io/redhat/redhat-operator-index:v4.6 -p cluster-logging -t master-0:5000/mirror-ocp4/redhat-operator-index:v4.6 podman push master-0:5000/mirror-ocp4/redhat-operator-index:v4.6 3. Mirror pruned catalog oc adm catalog mirror localhost:5000/mirror-ocp4/redhat-operator-index:v4.6 file:///local/index -a ../pullsecret --insecure --filter-by-os=linux/amd64 oc adm catalog mirror file://local/index/mirror-ocp4/redhat-operator-index:v4.6 localhost:5000/mirror-test2 --insecure -a ../pullsecret NOTE: All was done by following: https://docs.openshift.com/container-platform/4.6/operators/admin/olm-restricted-networks.html Actual results: Unable to upload pruned registry Expected results: Able to upload pruned registry Additional info: I was unable to try using default operator index. It is over 20GB is size and my medium was not that large. I am currently assuming targeting the original operator index above would cause the same scenario.
Sending this over to OLM team who owns oc adm catalog mirror
This issue has already been fixed in master/4.8/4.7. I marked as a dupe of the bug tracking the backport for 4.6, which is still pending. In the meantime, it is perfectly safe to use the 4.7 `oc` to perform the mirror. *** This bug has been marked as a duplicate of bug 1942818 ***