Bug 1869993 - "opm registry add" can not add operator bundle to operator registry DB.
Summary: "opm registry add" can not add operator bundle to operator registry DB.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: OLM
Version: 4.6
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
: 4.6.0
Assignee: Ankita Thomas
QA Contact: yhui
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-08-19 08:02 UTC by yhui
Modified: 2020-10-27 16:29 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-10-27 16:29:06 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2020:4196 0 None None None 2020-10-27 16:29:25 UTC

Description yhui 2020-08-19 08:02:06 UTC
Description of problem:
"opm registry add" can not add operator bundle to operator registry DB.

[root@preserve-olm-env prometheus]# /data/hui/salvarca/operator-registry/bin/opm registry add -d=bundles.db -b="quay.io/yuhui12/prometheus-test:0.15.0,quay.io/yuhui12/prometheus-test:0.15.0" 
INFO[0000] adding to the registry                        bundles="[quay.io/yuhui12/prometheus-test:0.15.0 quay.io/yuhui12/prometheus-test:0.15.0]"
Error: no such function: json_remove


Version-Release number of selected component (if applicable):
The latest master branch of operator-registry
[root@preserve-olm-env manager]# /data/hui/salvarca/operator-registry/bin/opm version
Version: version.Version{OpmVersion:"unknown", GitCommit:"", BuildDate:"", GoOs:"linux", GoArch:"amd64"}
commit 83d45fe5aace580fb40cd7802d8f2981fc826379
Merge: d724d65 fc53259
Author: OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>
Date:   Tue Aug 18 03:29:07 2020 +0200

    Merge pull request #420 from benluddy/undocument-label
    
    Remove label dependency from bundle docs.


How reproducible:
Always

Steps to Reproduce:
1. Install latest opm.
# git clone https://github.com/operator-framework/operator-registry
# cd operator-registry
# export GO111MODULE=on
# go build -mod=vendor -o bin/opm ./cmd/opm

2. Given set of operator manifests for a specific version. For example:

# tree 0.14.0/
0.14.0/
├── alertmanagers.monitoring.coreos.com.crd.yaml
├── prometheuses.monitoring.coreos.com.crd.yaml
├── prometheusoperator.0.14.0.clusterserviceversion.yaml
└── servicemonitors.monitoring.coreos.com.crd.yaml

3. Build two bundle image Like below:
# /data/hui/salvarca/operator-registry/bin/opm alpha bundle build --directory 0.14.0/ --tag quay.io/yuhui12/prometheus-test:0.14.0 --package prometheus --channels preview --default preview
# /data/hui/salvarca/operator-registry/bin/opm alpha bundle build --directory 0.15.0/ --tag quay.io/yuhui12/prometheus-test:0.15.0 --package prometheus --channels preview --default preview

4. Push the image
# docker push quay.io/yuhui12/prometheus-test:0.15.0
# docker push quay.io/yuhui12/prometheus-test:0.14.0

5. Add operator bundle to operator registry DB
[root@preserve-olm-env prometheus]# /data/hui/salvarca/operator-registry/bin/opm registry add -d=bundles.db -b="quay.io/yuhui12/prometheus-test:0.15.0,quay.io/yuhui12/prometheus-test:0.15.0" -c docker
INFO[0000] adding to the registry                        bundles="[quay.io/yuhui12/prometheus-test:0.15.0 quay.io/yuhui12/prometheus-test:0.15.0]"
Error: no such function: json_remove

[root@preserve-olm-env prometheus]# /data/hui/salvarca/operator-registry/bin/opm registry add -d=bundles.db -b="quay.io/yuhui12/prometheus-test:0.15.0,quay.io/yuhui12/prometheus-test:0.15.0" -c podman
INFO[0000] adding to the registry                        bundles="[quay.io/yuhui12/prometheus-test:0.15.0 quay.io/yuhui12/prometheus-test:0.15.0]"
Error: no such function: json_remove

Actual results:
There is an error using the command to add operator bundle to operator registry DB.

Expected results:
Add operator bundle to operator registry DB successfully.

Additional info:

Comment 1 Ankita Thomas 2020-08-19 18:00:38 UTC
operator-registry needs the go-sqlite3 package with its json extension enabled, so you need to either pass the `-tags "json1"` flag or use the Makefile to build the opm library.
Can you try using the following build command and see if that fixes the issue?

$ go build  -tags "json1" -o bin/opm ./cmd/opm

Comment 3 yhui 2020-08-27 06:37:37 UTC
Version:
[root@preserve-olm-env prometheus]# opm version
Version: version.Version{OpmVersion:"v1.12.5-116-g0deaced", GitCommit:"0deaced", BuildDate:"2020-08-21T08:16:50Z", GoOs:"linux", GoArch:"amd64"}

Steps to test:
1. Install latest opm.
# git clone https://github.com/operator-framework/operator-registry
# cd operator-registry
# go build ./cmd/opm/

2. Given set of operator manifests for a specific version. For example:

# tree 0.14.0/
0.14.0/
├── alertmanagers.monitoring.coreos.com.crd.yaml
├── prometheuses.monitoring.coreos.com.crd.yaml
├── prometheusoperator.0.14.0.clusterserviceversion.yaml
└── servicemonitors.monitoring.coreos.com.crd.yaml

3. Build two bundle image Like below:
# opm alpha bundle build --directory 0.14.0/ --tag quay.io/yuhui12/prometheus-test:0.14.0 --package prometheus --channels preview --default preview
# opm alpha bundle build --directory 0.15.0/ --tag quay.io/yuhui12/prometheus-test:0.15.0 --package prometheus --channels preview --default preview

4. Push the image
# docker push quay.io/yuhui12/prometheus-test:0.15.0
# docker push quay.io/yuhui12/prometheus-test:0.14.0

5. Add operator bundle to operator registry DB
# opm registry add -d=bundles.db -b="quay.io/yuhui12/prometheus-test:0.15.0,quay.io/yuhui12/prometheus-test:0.14.0" -c docker
INFO[0000] adding to the registry                        bundles="[quay.io/yuhui12/prometheus-test:0.15.0 quay.io/yuhui12/prometheus-test:0.14.0]"
INFO[0000] running /usr/bin/docker pull quay.io/yuhui12/prometheus-test:0.15.0  bundles="[quay.io/yuhui12/prometheus-test:0.15.0 quay.io/yuhui12/prometheus-test:0.14.0]"
INFO[0000] running docker create                         bundles="[quay.io/yuhui12/prometheus-test:0.15.0 quay.io/yuhui12/prometheus-test:0.14.0]"
INFO[0000] running docker cp                             bundles="[quay.io/yuhui12/prometheus-test:0.15.0 quay.io/yuhui12/prometheus-test:0.14.0]"
INFO[0001] running docker rm                             bundles="[quay.io/yuhui12/prometheus-test:0.15.0 quay.io/yuhui12/prometheus-test:0.14.0]"
INFO[0001] running /usr/bin/docker pull quay.io/yuhui12/prometheus-test:0.14.0  bundles="[quay.io/yuhui12/prometheus-test:0.15.0 quay.io/yuhui12/prometheus-test:0.14.0]"
INFO[0001] running docker create                         bundles="[quay.io/yuhui12/prometheus-test:0.15.0 quay.io/yuhui12/prometheus-test:0.14.0]"
INFO[0001] running docker cp                             bundles="[quay.io/yuhui12/prometheus-test:0.15.0 quay.io/yuhui12/prometheus-test:0.14.0]"
INFO[0001] running docker rm                             bundles="[quay.io/yuhui12/prometheus-test:0.15.0 quay.io/yuhui12/prometheus-test:0.14.0]"
INFO[0002] Could not find optional dependencies file     dir=bundle_tmp572370641 file=bundle_tmp572370641/metadata load=annotations
INFO[0002] found csv, loading bundle                     dir=bundle_tmp572370641 file=bundle_tmp572370641/manifests load=bundle
INFO[0002] loading bundle file                           dir=bundle_tmp572370641/manifests file=alertmanagers.monitoring.coreos.com.crd.yaml load=bundle
INFO[0002] loading bundle file                           dir=bundle_tmp572370641/manifests file=prometheuses.monitoring.coreos.com.crd.yaml load=bundle
INFO[0002] loading bundle file                           dir=bundle_tmp572370641/manifests file=prometheusoperator.0.15.0.clusterserviceversion.yaml load=bundle
INFO[0002] loading bundle file                           dir=bundle_tmp572370641/manifests file=servicemonitors.monitoring.coreos.com.crd.yaml load=bundle
INFO[0002] Could not find optional dependencies file     dir=bundle_tmp724614140 file=bundle_tmp724614140/metadata load=annotations
INFO[0002] found csv, loading bundle                     dir=bundle_tmp724614140 file=bundle_tmp724614140/manifests load=bundle
INFO[0002] loading bundle file                           dir=bundle_tmp724614140/manifests file=alertmanagers.monitoring.coreos.com.crd.yaml load=bundle
INFO[0002] loading bundle file                           dir=bundle_tmp724614140/manifests file=prometheuses.monitoring.coreos.com.crd.yaml load=bundle
INFO[0002] loading bundle file                           dir=bundle_tmp724614140/manifests file=prometheusoperator.0.14.0.clusterserviceversion.yaml load=bundle
INFO[0002] loading bundle file                           dir=bundle_tmp724614140/manifests file=servicemonitors.monitoring.coreos.com.crd.yaml load=bundle

[root@preserve-olm-env ~]# opm registry add -d=bundles.db -b="quay.io/yuhui12/prometheus-test:0.15.0,quay.io/yuhui12/prometheus-test:0.14.0" -c podman
INFO[0000] adding to the registry                        bundles="[quay.io/yuhui12/prometheus-test:0.15.0 quay.io/yuhui12/prometheus-test:0.14.0]"
INFO[0000] running /usr/bin/podman pull quay.io/yuhui12/prometheus-test:0.15.0  bundles="[quay.io/yuhui12/prometheus-test:0.15.0 quay.io/yuhui12/prometheus-test:0.14.0]"
INFO[0001] running podman create                         bundles="[quay.io/yuhui12/prometheus-test:0.15.0 quay.io/yuhui12/prometheus-test:0.14.0]"
INFO[0001] running podman cp                             bundles="[quay.io/yuhui12/prometheus-test:0.15.0 quay.io/yuhui12/prometheus-test:0.14.0]"
INFO[0002] running podman rm                             bundles="[quay.io/yuhui12/prometheus-test:0.15.0 quay.io/yuhui12/prometheus-test:0.14.0]"
INFO[0002] running /usr/bin/podman pull quay.io/yuhui12/prometheus-test:0.14.0  bundles="[quay.io/yuhui12/prometheus-test:0.15.0 quay.io/yuhui12/prometheus-test:0.14.0]"
INFO[0004] running podman create                         bundles="[quay.io/yuhui12/prometheus-test:0.15.0 quay.io/yuhui12/prometheus-test:0.14.0]"
INFO[0004] running podman cp                             bundles="[quay.io/yuhui12/prometheus-test:0.15.0 quay.io/yuhui12/prometheus-test:0.14.0]"
INFO[0004] running podman rm                             bundles="[quay.io/yuhui12/prometheus-test:0.15.0 quay.io/yuhui12/prometheus-test:0.14.0]"
INFO[0004] Could not find optional dependencies file     dir=bundle_tmp671063690 file=bundle_tmp671063690/metadata load=annotations
INFO[0004] found csv, loading bundle                     dir=bundle_tmp671063690 file=bundle_tmp671063690/manifests load=bundle
INFO[0004] loading bundle file                           dir=bundle_tmp671063690/manifests file=alertmanagers.monitoring.coreos.com.crd.yaml load=bundle
INFO[0004] loading bundle file                           dir=bundle_tmp671063690/manifests file=prometheuses.monitoring.coreos.com.crd.yaml load=bundle
INFO[0004] loading bundle file                           dir=bundle_tmp671063690/manifests file=prometheusoperator.0.15.0.clusterserviceversion.yaml load=bundle
INFO[0004] loading bundle file                           dir=bundle_tmp671063690/manifests file=servicemonitors.monitoring.coreos.com.crd.yaml load=bundle
INFO[0004] Could not find optional dependencies file     dir=bundle_tmp567896161 file=bundle_tmp567896161/metadata load=annotations
INFO[0005] found csv, loading bundle                     dir=bundle_tmp567896161 file=bundle_tmp567896161/manifests load=bundle
INFO[0005] loading bundle file                           dir=bundle_tmp567896161/manifests file=alertmanagers.monitoring.coreos.com.crd.yaml load=bundle
INFO[0005] loading bundle file                           dir=bundle_tmp567896161/manifests file=prometheuses.monitoring.coreos.com.crd.yaml load=bundle
INFO[0005] loading bundle file                           dir=bundle_tmp567896161/manifests file=prometheusoperator.0.14.0.clusterserviceversion.yaml load=bundle
INFO[0005] loading bundle file                           dir=bundle_tmp567896161/manifests file=servicemonitors.monitoring.coreos.com.crd.yaml load=bundle

There is no error info. Verify the bug.

Comment 6 errata-xmlrpc 2020-10-27 16:29:06 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 (OpenShift Container Platform 4.6 GA Images), 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:4196


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