Bug 1829832 - oc adm catalog mirror produces an empty db and list of images when mirroring an index image (vs an image built with oc adm catalog build)
Summary: oc adm catalog mirror produces an empty db and list of images when mirroring ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: OLM
Version: 4.5
Hardware: Unspecified
OS: Unspecified
urgent
high
Target Milestone: ---
: 4.5.0
Assignee: Evan Cordell
QA Contact: Jian Zhang
URL:
Whiteboard:
: 1828816 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-04-30 13:00 UTC by lgallett
Modified: 2022-11-03 12:30 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-07-13 17:33:40 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift oc pull 438 0 None closed Bug 1829832: support mirroring for index images 2020-12-22 12:19:41 UTC
Red Hat Product Errata RHBA-2020:2409 0 None None None 2020-07-13 17:33:59 UTC

Description lgallett 2020-04-30 13:00:36 UTC
Description of problem:

oc adm catalog mirror --insecure quay.io/galletti94/redhat-operators-index:v4.5 localhost:5000 --manifests-only --path=/database/index.db:

outputs an empty database and empty list of images in the mapping.txt and imageContentSourcePolicy.yaml

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

Client Version: 4.4.0-0.ci-2020-04-27-060546
also reproducible by compiling oc from master

How reproducible:

Always

Steps to Reproduce:
1. Spin up a local registry (can use instructions from https://www.openshift.com/blog/openshift-4-2-disconnected-install)
2. oc adm catalog mirror --insecure quay.io/galletti94/redhat-operators-index:v4.5 localhost:5000 --manifests-only

[mirror.go:231] wrote database to /tmp/077003041/bundles.db
[mirror.go:329] wrote mirroring manifests to redhat-operators-index-manifests

3. cat redhat-operators-index-manifests/imageContentSourcePolicy.yaml
4. sqlitebrowser /tmp/077003041/bundles.db

Actual results:

-> cat redhat-operators-index-manifests/imageContentSourcePolicy.yaml

apiVersion: operator.openshift.io/v1alpha1
kind: ImageContentSourcePolicy
metadata:
  name: redhat-operators-index
spec:
  repositoryDigestMirrors: []

-> sqlitebrowser /tmp/077003041/bundles.db

Shows an empty database

Expected results:

the repositoryDigestMirrors field and the database should not be empty

Additional info:

To sanity check that the image contains the database at that location:

oc image extract quay.io/galletti94/redhat-operators-index:v4.5 --file=/database/index.db

returns a non-empty index.db with the correct content

Note:

The bundle images in this index are only accessible through VPN. For reference these are the list of bundles in the above index image:

"registry-proxy-stage.engineering.redhat.com/rh-osbs-stage/e2e-e2e-test-rhel8-operator:8.0-350"
"registry-proxy.engineering.redhat.com/rh-osbs/amq7-amq-streams-rhel7-operator-metadata:1.0.0-1"
"registry-proxy.engineering.redhat.com/rh-osbs/amq7-amq-streams-rhel7-operator-metadata:1.1.0-1"
"registry-proxy.engineering.redhat.com/rh-osbs/amq7-amq-streams-rhel7-operator-metadata:1.2.0-1"
"registry-proxy.engineering.redhat.com/rh-osbs/amq7-amq-streams-rhel7-operator-metadata:1.3.0-1"
"registry-proxy.engineering.redhat.com/rh-osbs/amq7-amq-streams-rhel7-operator-metadata:1.4.0-1"
"registry-proxy.engineering.redhat.com/rh-osbs/lgallett-bundle:v1.1-14"
"registry-proxy.engineering.redhat.com/rh-osbs/openshift-service-mesh-kiali-operator-metadata:1.0-7"

Comment 1 Evan Cordell 2020-04-30 18:03:30 UTC
A workaround for anyone hitting this issue with an index image (i.e. the database is stored at `/database/index.db`:

```
$ oc adm catalog mirror <catalog> <mirror target> --path="/database/index.db:./" --manifests-only --dry-run
$ mv index.db bundles.db
$ oc adm catalog mirror <catalog> <mirror target> --path="/database/index.db:./" 
```

Comment 2 Evan Cordell 2020-05-25 18:06:36 UTC
*** Bug 1828816 has been marked as a duplicate of this bug. ***

Comment 5 Jian Zhang 2020-05-28 10:03:21 UTC
1, use the oc client with fixed PR merged in.

[root@preserve-olm-env data]# ./oc version -o yaml
clientVersion:
  buildDate: "2020-05-27T18:28:54Z"
  compiler: gc
  gitCommit: 06cc74b10770e609b99c0be95284331c94b14d85
  gitTreeState: dirty
  gitVersion: openshift-clients-4.5.0-202005271737
  goVersion: go1.13.4
  major: ""
  minor: ""
  platform: linux/amd64
openshiftVersion: 4.5.0-0.nightly-2020-05-27-202943
...

2, dry-run the mirror:
[root@preserve-olm-env data]# ./oc adm catalog mirror --insecure quay.io/galletti94/redhat-operators-index:v4.5 localhost:5000 --manifests-only 
src image has index label for database path: /database/index.db
using database path mapping: /database/index.db:/tmp/175145052
wrote database to /tmp/175145052
using database at: /tmp/175145052/index.db
no digest mapping available for registry-proxy-stage.engineering.redhat.com/rh-osbs-stage/e2e-e2e-test-rhel8-operator:8.0-350, skip writing to ImageContentSourcePolicy
no digest mapping available for registry-proxy.engineering.redhat.com/rh-osbs/openshift-service-mesh-kiali-operator-metadata:1.0-7, skip writing to ImageContentSourcePolicy
no digest mapping available for registry-proxy.engineering.redhat.com/rh-osbs/amq7-amq-streams-rhel7-operator-metadata:1.1.0-1, skip writing to ImageContentSourcePolicy
no digest mapping available for registry.access.redhat.com/amqstreams-1/amqstreams10-clusteroperator-openshift:1.0.0, skip writing to ImageContentSourcePolicy
no digest mapping available for registry.stage.redhat.io/openshift-service-mesh/kiali-rhel7-operator:1.0.5, skip writing to ImageContentSourcePolicy
no digest mapping available for registry.redhat.io/amq7/amq-streams-operator:1.3.0, skip writing to ImageContentSourcePolicy
no digest mapping available for registry.access.redhat.com/amq7/amq-streams-cluster-operator:1.1.0, skip writing to ImageContentSourcePolicy
no digest mapping available for registry-proxy.engineering.redhat.com/rh-osbs/amq7-amq-streams-rhel7-operator-metadata:1.4.0-1, skip writing to ImageContentSourcePolicy
no digest mapping available for registry-proxy.engineering.redhat.com/rh-osbs/amq7-amq-streams-rhel7-operator-metadata:1.3.0-1, skip writing to ImageContentSourcePolicy
no digest mapping available for registry-proxy.engineering.redhat.com/rh-osbs/amq7-amq-streams-rhel7-operator-metadata:1.2.0-1, skip writing to ImageContentSourcePolicy
no digest mapping available for registry.redhat.io/amq7/amq-streams-operator:1.2.0, skip writing to ImageContentSourcePolicy
no digest mapping available for registry-proxy.engineering.redhat.com/rh-osbs/lgallett-bundle:v1.1-14, skip writing to ImageContentSourcePolicy
no digest mapping available for registry-proxy.engineering.redhat.com/rh-osbs/amq7-amq-streams-rhel7-operator-metadata:1.0.0-1, skip writing to ImageContentSourcePolicy
wrote mirroring manifests to Redhat-operators-index-manifests

3, Check the generated database and ICSP files.
[root@preserve-olm-env data]# cat redhat-operators-index-manifests/imageContentSourcePolicy.yaml 
apiVersion: operator.openshift.io/v1alpha1
kind: ImageContentSourcePolicy
metadata:
  name: redhat-operators-index
spec:
  repositoryDigestMirrors:
  - mirrors:
    - localhost:5000/rhcam-1-1/openshift-migration-velero-rhel8
    source: image-registry.openshift-image-registry.svc:5000/rhcam-1-1/openshift-migration-velero-rhel8@sha256:db2997115d8a0767d61038e14f48170dc53d3c54b977184e7ecb37ead2f131da
  - mirrors:
    - localhost:5000/openshift4/ose-elasticsearch-operator
    source: registry.redhat.io/openshift4/ose-elasticsearch-operator@sha256:fce8d14e89b49c3b4cbeba27b0005ec8887a91b4a711fadbb2201cf03de43dea
  - mirrors:
...

[root@preserve-olm-env data]# sqlite3 /tmp/175145052/index.db
SQLite version 3.7.17 2013-05-20 00:56:22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .header on
sqlite> .mode column
sqlite> .table
api                channel            operatorbundle     schema_migrations
api_provider       channel_entry      package          
api_requirer       dependencies       related_image    
sqlite> select * from channel;
name        package_name       head_operatorbundle_name            
----------  -----------------  ------------------------------------
4.3         e2e-test-operator  e2e-test-operator.4.3.1-202002032140
stable      amq-streams        amqstreams.v1.4.0                   
release-v1  cam-operator       cam-operator.v1.1.0                 
stable      kiali-ossm         kiali-operator.v1.0.5               
sqlite> select * from related_image;
image                                                                                                                             operatorbundle_name                 
---------------------------------------------------------------------------------------------                                     ------------------------------------
registry.redhat.io/openshift4/ose-elasticsearch-operator@sha256:fce8d14e89b49c3b4cbeba27b0005ec8887a91b4a711fadbb2201cf03de43dea  e2e-test-operator.4.3.1-202002032140
registry.redhat.io/openshift4/ose-logging-elasticsearch5@sha256:52a806ed9e97476fdcf15199d2c3e1c6185ebad25deb0445bae5abbabd794c4a  e2e-test-operator.4.3.1-202002032140
registry.redhat.io/openshift4/ose-oauth-proxy@sha256:c51acb965b18ca94ec4dde07b5726f90174d569eb34ac4a7bd79cf71a63dec98             e2e-test-operator.4.3.1-202002032140
...

LGTM, verify it.

Comment 6 errata-xmlrpc 2020-07-13 17:33:40 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, 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/RHBA-2020:2409


Note You need to log in before you can comment on or make changes to this bug.