Bug 1889388 - ListBundles returns incorrect replaces/skips when bundles have been added via semver-skippatch mode
Summary: ListBundles returns incorrect replaces/skips when bundles have been added via...
Keywords:
Status: VERIFIED
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: OLM
Version: 4.7
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: 4.7.0
Assignee: Ben Luddy
QA Contact: kuiwang
URL:
Whiteboard:
: 1881220 (view as bug list)
Depends On:
Blocks: 1892360
TreeView+ depends on / blocked
 
Reported: 2020-10-19 14:38 UTC by Evan Cordell
Modified: 2020-11-19 07:36 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Github operator-framework operator-registry pull 483 None closed Bug 1889388: Set replaces in ListBundles query result using channel entries. 2020-11-23 01:41:43 UTC
Github operator-framework operator-registry pull 512 None closed Bug 1889388: Reconstruct replaces and skips for ListBundles from channel_entry. 2020-11-23 01:41:21 UTC

Description Evan Cordell 2020-10-19 14:38:10 UTC
See: https://github.com/operator-framework/operator-lifecycle-manager/issues/1771

ListBundles currently uses the skip/replaces fields on the operatorbundle table - this is incorrect, since those fields record what is in the bundle when it is added to the table.

"real" graph information should come from the channel_entry table, which is what semver mode manipulates when adding bundles.

Comment 3 Nick Hale 2020-10-23 17:31:02 UTC
Tests and reviews needed.

Comment 4 Nick Hale 2020-10-23 18:00:25 UTC
*** Bug 1881220 has been marked as a duplicate of this bug. ***

Comment 6 kuiwang 2020-11-02 05:47:14 UTC
build latest opm with the fix. and it still fail to install testoperatora

--
[root@preserve-olm-env operator-registry]# git log -n 1
commit fc70c12eae1948404bffebbfe1546b37eda94dd9
Merge: f83ace4 f76fdae
Author: OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>
Date:   Thu Oct 29 22:00:24 2020 +0100

    Merge pull request #501 from benluddy/upstream-release-go-114
    
    Build upstream releases with Go 1.14 instead of 1.15.
[root@preserve-olm-env operator-registry]# make build
GOFLAGS="-mod=vendor" go build  -tags "json1" -o bin/appregistry-server ./cmd/appregistry-server
GOFLAGS="-mod=vendor" go build  -tags "json1" -o bin/configmap-server ./cmd/configmap-server
GOFLAGS="-mod=vendor" go build  -tags "json1" -o bin/initializer ./cmd/initializer
GOFLAGS="-mod=vendor" go build  -tags "json1" -o bin/registry-server ./cmd/registry-server
GOFLAGS="-mod=vendor" go build -ldflags "-X 'github.com/operator-framework/operator-registry/cmd/opm/version.gitCommit=fc70c12' -X 'github.com/operator-framework/operator-registry/cmd/opm/version.opmVersion=v1.14.3-45-gfc70c12' -X 'github.com/operator-framework/operator-registry/cmd/opm/version.buildDate=2020-11-02T05:12:07Z'"  -tags "json1" -o bin/opm ./cmd/opm


[root@preserve-olm-env operator-registry]# bin/opm index export --index="docker.io/cdjohnson/depcatalogs@sha256:78d736b0d3c3d288d3000eea0c1640441031357f77ed4215f78e661aabc108ae" --package="testoperatora" -c docker
INFO[0000] export from the index                         index="docker.io/cdjohnson/depcatalogs@sha256:78d736b0d3c3d288d3000eea0c1640441031357f77ed4215f78e661aabc108ae" package="[testoperatora]"
INFO[0000] Pulling previous image docker.io/cdjohnson/depcatalogs@sha256:78d736b0d3c3d288d3000eea0c1640441031357f77ed4215f78e661aabc108ae to get metadata  index="docker.io/cdjohnson/depcatalogs@sha256:78d736b0d3c3d288d3000eea0c1640441031357f77ed4215f78e661aabc108ae" package="[testoperatora]"
INFO[0000] running /usr/bin/docker pull docker.io/cdjohnson/depcatalogs@sha256:78d736b0d3c3d288d3000eea0c1640441031357f77ed4215f78e661aabc108ae  index="docker.io/cdjohnson/depcatalogs@sha256:78d736b0d3c3d288d3000eea0c1640441031357f77ed4215f78e661aabc108ae" package="[testoperatora]"
INFO[0000] running /usr/bin/docker pull docker.io/cdjohnson/depcatalogs@sha256:78d736b0d3c3d288d3000eea0c1640441031357f77ed4215f78e661aabc108ae  index="docker.io/cdjohnson/depcatalogs@sha256:78d736b0d3c3d288d3000eea0c1640441031357f77ed4215f78e661aabc108ae" package="[testoperatora]"
INFO[0000] Getting label data from previous image        index="docker.io/cdjohnson/depcatalogs@sha256:78d736b0d3c3d288d3000eea0c1640441031357f77ed4215f78e661aabc108ae" package="[testoperatora]"
INFO[0000] running docker inspect                        index="docker.io/cdjohnson/depcatalogs@sha256:78d736b0d3c3d288d3000eea0c1640441031357f77ed4215f78e661aabc108ae" package="[testoperatora]"
INFO[0000] running docker create                         index="docker.io/cdjohnson/depcatalogs@sha256:78d736b0d3c3d288d3000eea0c1640441031357f77ed4215f78e661aabc108ae" package="[testoperatora]"
INFO[0000] running docker cp                             index="docker.io/cdjohnson/depcatalogs@sha256:78d736b0d3c3d288d3000eea0c1640441031357f77ed4215f78e661aabc108ae" package="[testoperatora]"
INFO[0001] running docker rm                             index="docker.io/cdjohnson/depcatalogs@sha256:78d736b0d3c3d288d3000eea0c1640441031357f77ed4215f78e661aabc108ae" package="[testoperatora]"
INFO[0001] Preparing to pull bundles map["docker.io/cdjohnson/testoperatora@sha256:22645b35d57080e2465a0803397442a1df0a8f4c89c6defcd10a4958d8677f0b":{"testoperatora" "1.0.0"} "docker.io/cdjohnson/testoperatora@sha256:fbad4133aafba3f848ef8028688f4f76b5285106a1ce57fbf2c47a9a766cfc24":{"testoperatora" "1.0.1"}]  index="docker.io/cdjohnson/depcatalogs@sha256:78d736b0d3c3d288d3000eea0c1640441031357f77ed4215f78e661aabc108ae" package="[testoperatora]"
INFO[0001] running /usr/bin/docker pull docker.io/cdjohnson/testoperatora@sha256:fbad4133aafba3f848ef8028688f4f76b5285106a1ce57fbf2c47a9a766cfc24  img="docker.io/cdjohnson/testoperatora@sha256:fbad4133aafba3f848ef8028688f4f76b5285106a1ce57fbf2c47a9a766cfc24"
INFO[0001] running /usr/bin/docker pull docker.io/cdjohnson/testoperatora@sha256:22645b35d57080e2465a0803397442a1df0a8f4c89c6defcd10a4958d8677f0b  img="docker.io/cdjohnson/testoperatora@sha256:22645b35d57080e2465a0803397442a1df0a8f4c89c6defcd10a4958d8677f0b"
INFO[0002] running docker create                         img="docker.io/cdjohnson/testoperatora@sha256:22645b35d57080e2465a0803397442a1df0a8f4c89c6defcd10a4958d8677f0b"
INFO[0002] running docker cp                             img="docker.io/cdjohnson/testoperatora@sha256:22645b35d57080e2465a0803397442a1df0a8f4c89c6defcd10a4958d8677f0b"
INFO[0003] running docker rm                             img="docker.io/cdjohnson/testoperatora@sha256:22645b35d57080e2465a0803397442a1df0a8f4c89c6defcd10a4958d8677f0b"
INFO[0003] running docker create                         img="docker.io/cdjohnson/testoperatora@sha256:fbad4133aafba3f848ef8028688f4f76b5285106a1ce57fbf2c47a9a766cfc24"
INFO[0003] running docker cp                             img="docker.io/cdjohnson/testoperatora@sha256:fbad4133aafba3f848ef8028688f4f76b5285106a1ce57fbf2c47a9a766cfc24"
INFO[0003] running docker rm                             img="docker.io/cdjohnson/testoperatora@sha256:fbad4133aafba3f848ef8028688f4f76b5285106a1ce57fbf2c47a9a766cfc24"
INFO[0003] Writing package.yaml in downloaded/testoperatora 
[root@preserve-olm-env operator-registry]# cd downloaded/testoperatora/
[root@preserve-olm-env testoperatora]# ls
1.0.0  1.0.1  package.yaml
[root@preserve-olm-env testoperatora]# cd ..
[root@preserve-olm-env downloaded]# ls
testoperatora
[root@preserve-olm-env downloaded]# mv testoperatora testoperatora-08ae


[root@preserve-olm-env operator-registry]# ./bin/opm alpha bundle build --directory /root/kuiwang/operator-registry/downloaded/testoperatora-08ae/1.0.0 --tag quay.io/kuiwang/depcatalogs:v1 -p testoperatorb -c v1.0 -e v1.0
INFO[0000] Building annotations.yaml                    
INFO[0000] Writing annotations.yaml in /root/kuiwang/operator-registry/downloaded/testoperatora-08ae/metadata 
INFO[0000] Building Dockerfile                          
INFO[0000] Writing bundle.Dockerfile in /root/kuiwang/operator-registry 
INFO[0000] Building bundle image                        
Sending build context to Docker daemon  266.8MB
Step 1/9 : FROM scratch
 ---> 
Step 2/9 : LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
 ---> Using cache
 ---> e4b01c2bb11d
Step 3/9 : LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
 ---> Using cache
 ---> 05191049f5aa
Step 4/9 : LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
 ---> Using cache
 ---> 131eef1021c4
Step 5/9 : LABEL operators.operatorframework.io.bundle.package.v1=testoperatorb
 ---> Running in b0aa6b54698c
Removing intermediate container b0aa6b54698c
 ---> bd8e4902fdf5
Step 6/9 : LABEL operators.operatorframework.io.bundle.channels.v1=v1.0
 ---> Running in c19835f51b29
Removing intermediate container c19835f51b29
 ---> f5b7d2af678d
Step 7/9 : LABEL operators.operatorframework.io.bundle.channel.default.v1=v1.0
 ---> Running in 1b6fa5fe2712
Removing intermediate container 1b6fa5fe2712
 ---> b9c30ca4b1f6
Step 8/9 : COPY downloaded/testoperatora-08ae/1.0.0 /manifests/
 ---> aefbd778b92b
Step 9/9 : COPY downloaded/testoperatora-08ae/metadata /metadata/
 ---> cf14b421cc2a
Successfully built cf14b421cc2a
Successfully tagged quay.io/kuiwang/depcatalogs:v1
[root@preserve-olm-env operator-registry]# docker push quay.io/kuiwang/depcatalogs:v1
The push refers to repository [quay.io/kuiwang/depcatalogs]
ff352ea4e98c: Pushed 
e2858c8a098e: Pushed 
v1: digest: sha256:fb83b25f17eb087195fd046d3afa11d68c058fea601bc314f5aa1ce76796972f size: 732
[root@preserve-olm-env operator-registry]# rm -fr bundle.Dockerfile downloaded/testoperatora-08ae/metadata/
[root@preserve-olm-env operator-registry]# 





[root@preserve-olm-env operator-registry]# ./bin/opm alpha bundle build --directory /root/kuiwang/operator-registry/downloaded/testoperatora-08ae/1.0.1 --tag quay.io/kuiwang/depcatalogs:v11 -p testoperatorb -c v1.0 -e v1.0
INFO[0000] Building annotations.yaml                    
INFO[0000] Writing annotations.yaml in /root/kuiwang/operator-registry/downloaded/testoperatora-08ae/metadata 
INFO[0000] Building Dockerfile                          
INFO[0000] Writing bundle.Dockerfile in /root/kuiwang/operator-registry 
INFO[0000] Building bundle image                        
Sending build context to Docker daemon  266.8MB
Step 1/9 : FROM scratch
 ---> 
Step 2/9 : LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
 ---> Using cache
 ---> e4b01c2bb11d
Step 3/9 : LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
 ---> Using cache
 ---> 05191049f5aa
Step 4/9 : LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
 ---> Using cache
 ---> 131eef1021c4
Step 5/9 : LABEL operators.operatorframework.io.bundle.package.v1=testoperatorb
 ---> Using cache
 ---> bd8e4902fdf5
Step 6/9 : LABEL operators.operatorframework.io.bundle.channels.v1=v1.0
 ---> Using cache
 ---> f5b7d2af678d
Step 7/9 : LABEL operators.operatorframework.io.bundle.channel.default.v1=v1.0
 ---> Using cache
 ---> b9c30ca4b1f6
Step 8/9 : COPY downloaded/testoperatora-08ae/1.0.1 /manifests/
 ---> 35653f5ab715
Step 9/9 : COPY downloaded/testoperatora-08ae/metadata /metadata/
 ---> ec0d76a1cd87
Successfully built ec0d76a1cd87
Successfully tagged quay.io/kuiwang/depcatalogs:v11
[root@preserve-olm-env operator-registry]# docker push quay.io/kuiwang/depcatalogs:v11
The push refers to repository [quay.io/kuiwang/depcatalogs]
ac1389c8dced: Pushed 
206e17beb1e9: Pushed 
v11: digest: sha256:acc96ae2610d0eadff1c935d423e00f5c7a89965637598e1c29c50115f47cce4 size: 732
[root@preserve-olm-env operator-registry]# rm -fr bundle.Dockerfile downloaded/testoperatora-08ae/metadata
[root@preserve-olm-env operator-registry]# 
[root@preserve-olm-env operator-registry]# 
[root@preserve-olm-env operator-registry]# ./bin/opm index add --bundles quay.io/kuiwang/depcatalogs:v1 --tag quay.io/kuiwang/depcatalogs-index:1889388 -c docker --mode=semver-skippatch
INFO[0000] building the index                            bundles="[quay.io/kuiwang/depcatalogs:v1]"
INFO[0000] running /usr/bin/docker pull quay.io/kuiwang/depcatalogs:v1  bundles="[quay.io/kuiwang/depcatalogs:v1]"
INFO[0000] running docker create                         bundles="[quay.io/kuiwang/depcatalogs:v1]"
INFO[0000] running docker cp                             bundles="[quay.io/kuiwang/depcatalogs:v1]"
INFO[0000] running docker rm                             bundles="[quay.io/kuiwang/depcatalogs:v1]"
INFO[0000] Could not find optional dependencies file     dir=bundle_tmp314356590 file=bundle_tmp314356590/metadata load=annotations
INFO[0000] found csv, loading bundle                     dir=bundle_tmp314356590 file=bundle_tmp314356590/manifests load=bundle
INFO[0000] loading bundle file                           dir=bundle_tmp314356590/manifests file=testoperatora-1-crd.yaml load=bundle
INFO[0000] loading bundle file                           dir=bundle_tmp314356590/manifests file=testoperatora-cm.yaml load=bundle
INFO[0000] loading bundle file                           dir=bundle_tmp314356590/manifests file=testoperatora-secret.yaml load=bundle
INFO[0000] loading bundle file                           dir=bundle_tmp314356590/manifests file=testoperatora-v1.0.0-csv.yaml load=bundle
INFO[0000] Generating dockerfile                         bundles="[quay.io/kuiwang/depcatalogs:v1]"
INFO[0000] writing dockerfile: index.Dockerfile241312220  bundles="[quay.io/kuiwang/depcatalogs:v1]"
INFO[0000] running docker build                          bundles="[quay.io/kuiwang/depcatalogs:v1]"
INFO[0000] [docker build -f index.Dockerfile241312220 -t quay.io/kuiwang/depcatalogs-index:1889388 .]  bundles="[quay.io/kuiwang/depcatalogs:v1]"
[root@preserve-olm-env operator-registry]# docker push quay.io/kuiwang/depcatalogs-index:1889388
The push refers to repository [quay.io/kuiwang/depcatalogs-index]
1b9fef3eeb21: Pushed 
14d454bac30e: Mounted from kuiwang/etcd-index 
7a12ba9c099a: Mounted from kuiwang/etcd-index 
371d4702865c: Mounted from kuiwang/etcd-index 
4570b0d18853: Mounted from kuiwang/etcd-index 
ace0eda3e3be: Mounted from kuiwang/etcd-index 
1889388: digest: sha256:d86a93f9f28999f0f235411889e486f96b205228f350f19440ca96846c625776 size: 1577
[root@preserve-olm-env operator-registry]# ./bin/opm index add --bundles quay.io/kuiwang/depcatalogs:v11 --from-index quay.io/kuiwang/depcatalogs-index:1889388 --tag quay.io/kuiwang/depcatalogs-index:1889388 -c docker --mode=semver-skippatch
INFO[0000] building the index                            bundles="[quay.io/kuiwang/depcatalogs:v11]"
INFO[0000] Pulling previous image quay.io/kuiwang/depcatalogs-index:1889388 to get metadata  bundles="[quay.io/kuiwang/depcatalogs:v11]"
INFO[0000] running /usr/bin/docker pull quay.io/kuiwang/depcatalogs-index:1889388  bundles="[quay.io/kuiwang/depcatalogs:v11]"
INFO[0000] running /usr/bin/docker pull quay.io/kuiwang/depcatalogs-index:1889388  bundles="[quay.io/kuiwang/depcatalogs:v11]"
INFO[0001] Getting label data from previous image        bundles="[quay.io/kuiwang/depcatalogs:v11]"
INFO[0001] running docker inspect                        bundles="[quay.io/kuiwang/depcatalogs:v11]"
INFO[0001] running docker create                         bundles="[quay.io/kuiwang/depcatalogs:v11]"
INFO[0001] running docker cp                             bundles="[quay.io/kuiwang/depcatalogs:v11]"
INFO[0001] running docker rm                             bundles="[quay.io/kuiwang/depcatalogs:v11]"
INFO[0001] running /usr/bin/docker pull quay.io/kuiwang/depcatalogs:v11  bundles="[quay.io/kuiwang/depcatalogs:v11]"
INFO[0002] running docker create                         bundles="[quay.io/kuiwang/depcatalogs:v11]"
INFO[0002] running docker cp                             bundles="[quay.io/kuiwang/depcatalogs:v11]"
INFO[0002] running docker rm                             bundles="[quay.io/kuiwang/depcatalogs:v11]"
INFO[0002] Could not find optional dependencies file     dir=bundle_tmp824438917 file=bundle_tmp824438917/metadata load=annotations
INFO[0002] found csv, loading bundle                     dir=bundle_tmp824438917 file=bundle_tmp824438917/manifests load=bundle
INFO[0002] loading bundle file                           dir=bundle_tmp824438917/manifests file=testoperatora-1-crd.yaml load=bundle
INFO[0002] loading bundle file                           dir=bundle_tmp824438917/manifests file=testoperatora-cm.yaml load=bundle
INFO[0002] loading bundle file                           dir=bundle_tmp824438917/manifests file=testoperatora-secret.yaml load=bundle
INFO[0002] loading bundle file                           dir=bundle_tmp824438917/manifests file=testoperatora-v1.0.1-csv.yaml load=bundle
INFO[0002] Generating dockerfile                         bundles="[quay.io/kuiwang/depcatalogs:v11]"
INFO[0002] writing dockerfile: index.Dockerfile710835099  bundles="[quay.io/kuiwang/depcatalogs:v11]"
INFO[0002] running docker build                          bundles="[quay.io/kuiwang/depcatalogs:v11]"
INFO[0002] [docker build -f index.Dockerfile710835099 -t quay.io/kuiwang/depcatalogs-index:1889388 .]  bundles="[quay.io/kuiwang/depcatalogs:v11]"
[root@preserve-olm-env operator-registry]# docker push quay.io/kuiwang/depcatalogs-index:1889388
The push refers to repository [quay.io/kuiwang/depcatalogs-index]
b220964ed033: Pushed 
14d454bac30e: Layer already exists 
7a12ba9c099a: Layer already exists 
371d4702865c: Layer already exists 
4570b0d18853: Layer already exists 
ace0eda3e3be: Layer already exists 
1889388: digest: sha256:08be8f8aaf2cd30b151f74f4b34b3016ebb23763435e4b5fe2330069dbfeaa3c size: 1577



[root@preserve-olm-env 1889388]# cat tetcatsrc.yaml 
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
  name: depcatalogs
  namespace: default
spec:
  displayName: "depcatalogs-semver-dep-nowork Operators"
  image: quay.io/kuiwang/depcatalogs-index:1889388
  publisher: IBM
  sourceType: grpc
[root@preserve-olm-env 1889388]# oc apply -f tetcatsrc.yaml 
catalogsource.operators.coreos.com/depcatalogs created
[root@preserve-olm-env 1889388]# oc get pod
NAME                READY   STATUS    RESTARTS   AGE
depcatalogs-c7vzt   0/1     Running   0          8s

[root@preserve-olm-env 1889388]# cat tetsub.yaml 
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  name: testoperatorb
  namespace: default
spec:
  source: depcatalogs
  sourceNamespace: default

  channel: v1.0
  installPlanApproval: Automatic
  name: testoperatorb
  startingCSV: testoperatorb.v1.0.0
[root@preserve-olm-env 1889388]# oc apply -f tetsub.yaml 
subscription.operators.coreos.com/testoperatorb created
[root@preserve-olm-env 1889388]# oc get sub
NAME            PACKAGE         SOURCE        CHANNEL
testoperatorb   testoperatorb   depcatalogs   v1.0
[root@preserve-olm-env 1889388]# oc get csv
No resources found in default namespace.
[root@preserve-olm-env 1889388]# oc get ip
No resources found in default namespace.

[root@preserve-olm-env 1889388]# oc logs catalog-operator-5566c989c9-s5prn -n openshift-operator-lifecycle-manager
E1102 05:35:04.542004       1 queueinformer_operator.go:290] sync "default" failed: found multiple channel heads: [testoperatora.v1.0.1 testoperatora.v1.0.0], please check the `replaces`/`skipRange` fields of the operator bundles
I1102 05:35:04.542099       1 event.go:278] Event(v1.ObjectReference{Kind:"Namespace", Namespace:"", Name:"default", UID:"46ed61c3-ea29-442e-aa34-89f4c9dbf4a5", APIVersion:"v1", ResourceVersion:"39643", FieldPath:""}): type: 'Warning' reason: 'ResolutionFailed' found multiple channel heads: [testoperatora.v1.0.1 testoperatora.v1.0.0], please check the `replaces`/`skipRange` fields of the operator bundles
I1102 05:35:05.191119       1 event.go:278] Event(v1.ObjectReference{Kind:"Namespace", Namespace:"", Name:"default", UID:"46ed61c3-ea29-442e-aa34-89f4c9dbf4a5", APIVersion:"v1", ResourceVersion:"39643", FieldPath:""}): type: 'Warning' reason: 'ResolutionFailed' found multiple channel heads: [testoperatora.v1.0.1 testoperatora.v1.0.0], please check the `replaces`/`skipRange` fields of the operator bundles

--

Comment 9 kuiwang 2020-11-18 05:49:05 UTC
verify it on 4.7. Fail

--
[root@preserve-olm-env operator-registry]# git log -n 1
commit 36dc231df42d611494a69fa5b4d1868ce06f2100
Merge: ed41d85 85320d5
Author: OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>
Date:   Fri Nov 13 15:37:37 2020 +0100
 
    Merge pull request #516 from openshift-bot/art-consistency-openshift-4.7-operator-registry
   
    Updating operator-registry builder & base images to be consistent with ART
[root@preserve-olm-env operator-registry]# make clean
[root@preserve-olm-env operator-registry]# make build
GOFLAGS="-mod=vendor" go build  -tags "json1" -o bin/appregistry-server ./cmd/appregistry-server
GOFLAGS="-mod=vendor" go build  -tags "json1" -o bin/configmap-server ./cmd/configmap-server
GOFLAGS="-mod=vendor" go build  -tags "json1" -o bin/initializer ./cmd/initializer
GOFLAGS="-mod=vendor" go build  -tags "json1" -o bin/registry-server ./cmd/registry-server
GOFLAGS="-mod=vendor" go build -ldflags "-X 'github.com/operator-framework/operator-registry/cmd/opm/version.gitCommit=36dc231' -X 'github.com/operator-framework/operator-registry/cmd/opm/version.opmVersion=v1.14.3-57-g36dc231' -X 'github.com/operator-framework/operator-registry/cmd/opm/version.buildDate=2020-11-16T02:34:22Z'"  -tags "json1" -o bin/opm ./cmd/opm
 
[root@preserve-olm-env operator-registry]# bin/opm index export --index="docker.io/cdjohnson/depcatalogs@sha256:78d736b0d3c3d288d3000eea0c1640441031357f77ed4215f78e661aabc108ae" --package="testoperatora" -c docker
INFO[0000] export from the index                         index="docker.io/cdjohnson/depcatalogs@sha256:78d736b0d3c3d288d3000eea0c1640441031357f77ed4215f78e661aabc108ae" package="[testoperatora]"
INFO[0000] Pulling previous image docker.io/cdjohnson/depcatalogs@sha256:78d736b0d3c3d288d3000eea0c1640441031357f77ed4215f78e661aabc108ae to get metadata  index="docker.io/cdjohnson/depcatalogs@sha256:78d736b0d3c3d288d3000eea0c1640441031357f77ed4215f78e661aabc108ae" package="[testoperatora]"
INFO[0000] running /usr/bin/docker pull docker.io/cdjohnson/depcatalogs@sha256:78d736b0d3c3d288d3000eea0c1640441031357f77ed4215f78e661aabc108ae  index="docker.io/cdjohnson/depcatalogs@sha256:78d736b0d3c3d288d3000eea0c1640441031357f77ed4215f78e661aabc108ae" package="[testoperatora]"
INFO[0000] running /usr/bin/docker pull docker.io/cdjohnson/depcatalogs@sha256:78d736b0d3c3d288d3000eea0c1640441031357f77ed4215f78e661aabc108ae  index="docker.io/cdjohnson/depcatalogs@sha256:78d736b0d3c3d288d3000eea0c1640441031357f77ed4215f78e661aabc108ae" package="[testoperatora]"
INFO[0000] Getting label data from previous image        index="docker.io/cdjohnson/depcatalogs@sha256:78d736b0d3c3d288d3000eea0c1640441031357f77ed4215f78e661aabc108ae" package="[testoperatora]"
INFO[0000] running docker inspect                        index="docker.io/cdjohnson/depcatalogs@sha256:78d736b0d3c3d288d3000eea0c1640441031357f77ed4215f78e661aabc108ae" package="[testoperatora]"
INFO[0000] running docker create                         index="docker.io/cdjohnson/depcatalogs@sha256:78d736b0d3c3d288d3000eea0c1640441031357f77ed4215f78e661aabc108ae" package="[testoperatora]"
INFO[0000] running docker cp                             index="docker.io/cdjohnson/depcatalogs@sha256:78d736b0d3c3d288d3000eea0c1640441031357f77ed4215f78e661aabc108ae" package="[testoperatora]"
INFO[0001] running docker rm                             index="docker.io/cdjohnson/depcatalogs@sha256:78d736b0d3c3d288d3000eea0c1640441031357f77ed4215f78e661aabc108ae" package="[testoperatora]"
INFO[0001] Preparing to pull bundles map["docker.io/cdjohnson/testoperatora@sha256:22645b35d57080e2465a0803397442a1df0a8f4c89c6defcd10a4958d8677f0b":{"testoperatora" "1.0.0"} "docker.io/cdjohnson/testoperatora@sha256:fbad4133aafba3f848ef8028688f4f76b5285106a1ce57fbf2c47a9a766cfc24":{"testoperatora" "1.0.1"}]  index="docker.io/cdjohnson/depcatalogs@sha256:78d736b0d3c3d288d3000eea0c1640441031357f77ed4215f78e661aabc108ae" package="[testoperatora]"
INFO[0001] running /usr/bin/docker pull docker.io/cdjohnson/testoperatora@sha256:fbad4133aafba3f848ef8028688f4f76b5285106a1ce57fbf2c47a9a766cfc24  img="docker.io/cdjohnson/testoperatora@sha256:fbad4133aafba3f848ef8028688f4f76b5285106a1ce57fbf2c47a9a766cfc24"
INFO[0001] running /usr/bin/docker pull docker.io/cdjohnson/testoperatora@sha256:22645b35d57080e2465a0803397442a1df0a8f4c89c6defcd10a4958d8677f0b  img="docker.io/cdjohnson/testoperatora@sha256:22645b35d57080e2465a0803397442a1df0a8f4c89c6defcd10a4958d8677f0b"
INFO[0002] running docker create                         img="docker.io/cdjohnson/testoperatora@sha256:22645b35d57080e2465a0803397442a1df0a8f4c89c6defcd10a4958d8677f0b"
INFO[0002] running docker cp                             img="docker.io/cdjohnson/testoperatora@sha256:22645b35d57080e2465a0803397442a1df0a8f4c89c6defcd10a4958d8677f0b"
INFO[0003] running docker rm                             img="docker.io/cdjohnson/testoperatora@sha256:22645b35d57080e2465a0803397442a1df0a8f4c89c6defcd10a4958d8677f0b"
INFO[0003] running docker create                         img="docker.io/cdjohnson/testoperatora@sha256:fbad4133aafba3f848ef8028688f4f76b5285106a1ce57fbf2c47a9a766cfc24"
INFO[0003] running docker cp                             img="docker.io/cdjohnson/testoperatora@sha256:fbad4133aafba3f848ef8028688f4f76b5285106a1ce57fbf2c47a9a766cfc24"
INFO[0003] running docker rm                             img="docker.io/cdjohnson/testoperatora@sha256:fbad4133aafba3f848ef8028688f4f76b5285106a1ce57fbf2c47a9a766cfc24"
INFO[0003] Writing package.yaml in downloaded/testoperatora
[root@preserve-olm-env operator-registry]# cd downloaded/testoperatora/
[root@preserve-olm-env testoperatora]# ls
1.0.0  1.0.1  package.yaml
[root@preserve-olm-env testoperatora]# cd ..
[root@preserve-olm-env downloaded]# ls
testoperatora
[root@preserve-olm-env downloaded]# mv testoperatora testoperatora-08ae
 
 
 
[root@preserve-olm-env operator-registry]# ./bin/opm alpha bundle build --directory /root/kuiwang/operator-registry/downloaded/testoperatora-08ae/1.0.0 --tag quay.io/kuiwang/depcatalogs:v1 -p testoperatorb -c v1.0 -e v1.0
INFO[0000] Building annotations.yaml                    
INFO[0000] Writing annotations.yaml in /root/kuiwang/operator-registry/downloaded/testoperatora-08ae/metadata
INFO[0000] Building Dockerfile                          
INFO[0000] Writing bundle.Dockerfile in /root/kuiwang/operator-registry
INFO[0000] Building bundle image                        
Sending build context to Docker daemon  270.2MB
Step 1/9 : FROM scratch
 --->
Step 2/9 : LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
 ---> Using cache
 ---> e4b01c2bb11d
Step 3/9 : LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
 ---> Using cache
 ---> 05191049f5aa
Step 4/9 : LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
 ---> Using cache
 ---> 131eef1021c4
Step 5/9 : LABEL operators.operatorframework.io.bundle.package.v1=testoperatorb
 ---> Using cache
 ---> bd8e4902fdf5
Step 6/9 : LABEL operators.operatorframework.io.bundle.channels.v1=v1.0
 ---> Using cache
 ---> f5b7d2af678d
Step 7/9 : LABEL operators.operatorframework.io.bundle.channel.default.v1=v1.0
 ---> Using cache
 ---> b9c30ca4b1f6
Step 8/9 : COPY downloaded/testoperatora-08ae/1.0.0 /manifests/
 ---> Using cache
 ---> aefbd778b92b
Step 9/9 : COPY downloaded/testoperatora-08ae/metadata /metadata/
 ---> Using cache
 ---> cf14b421cc2a
Successfully built cf14b421cc2a
Successfully tagged quay.io/kuiwang/depcatalogs:v1
 
[root@preserve-olm-env operator-registry]# docker push quay.io/kuiwang/depcatalogs:v1
The push refers to repository [quay.io/kuiwang/depcatalogs]
ff352ea4e98c: Layer already exists
e2858c8a098e: Layer already exists
v1: digest: sha256:fb83b25f17eb087195fd046d3afa11d68c058fea601bc314f5aa1ce76796972f size: 732
[root@preserve-olm-env operator-registry]# rm -fr bundle.Dockerfile downloaded/testoperatora-08ae/metadata/
[root@preserve-olm-env operator-registry]#
 
[root@preserve-olm-env operator-registry]# ./bin/opm alpha bundle build --directory /root/kuiwang/operator-registry/downloaded/testoperatora-08ae/1.0.1 --tag quay.io/kuiwang/depcatalogs:v11 -p testoperatorb -c v1.0 -e v1.0
INFO[0000] Building annotations.yaml                    
INFO[0000] Writing annotations.yaml in /root/kuiwang/operator-registry/downloaded/testoperatora-08ae/metadata
INFO[0000] Building Dockerfile                          
INFO[0000] Writing bundle.Dockerfile in /root/kuiwang/operator-registry
INFO[0000] Building bundle image                        
Sending build context to Docker daemon  270.2MB
Step 1/9 : FROM scratch
 --->
Step 2/9 : LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
 ---> Using cache
 ---> e4b01c2bb11d
Step 3/9 : LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
 ---> Using cache
 ---> 05191049f5aa
Step 4/9 : LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
 ---> Using cache
 ---> 131eef1021c4
Step 5/9 : LABEL operators.operatorframework.io.bundle.package.v1=testoperatorb
 ---> Using cache
 ---> bd8e4902fdf5
Step 6/9 : LABEL operators.operatorframework.io.bundle.channels.v1=v1.0
 ---> Using cache
 ---> f5b7d2af678d
Step 7/9 : LABEL operators.operatorframework.io.bundle.channel.default.v1=v1.0
 ---> Using cache
 ---> b9c30ca4b1f6
Step 8/9 : COPY downloaded/testoperatora-08ae/1.0.1 /manifests/
 ---> Using cache
 ---> 35653f5ab715
Step 9/9 : COPY downloaded/testoperatora-08ae/metadata /metadata/
 ---> Using cache
 ---> ec0d76a1cd87
Successfully built ec0d76a1cd87
Successfully tagged quay.io/kuiwang/depcatalogs:v11
[root@preserve-olm-env operator-registry]# docker push quay.io/kuiwang/depcatalogs:v11
The push refers to repository [quay.io/kuiwang/depcatalogs]
ac1389c8dced: Layer already exists
206e17beb1e9: Layer already exists
v11: digest: sha256:acc96ae2610d0eadff1c935d423e00f5c7a89965637598e1c29c50115f47cce4 size: 732
[root@preserve-olm-env operator-registry]# rm -fr bundle.Dockerfile downloaded/testoperatora-08ae/metadata
[root@preserve-olm-env operator-registry]#
 
 
[root@preserve-olm-env operator-registry]# ./bin/opm index add --bundles quay.io/kuiwang/depcatalogs:v1 --tag quay.io/kuiwang/depcatalogs-index:1889388 -c docker --mode=semver-skippatch
INFO[0000] building the index                            bundles="[quay.io/kuiwang/depcatalogs:v1]"
INFO[0000] running /usr/bin/docker pull quay.io/kuiwang/depcatalogs:v1  bundles="[quay.io/kuiwang/depcatalogs:v1]"
INFO[0000] running docker create                         bundles="[quay.io/kuiwang/depcatalogs:v1]"
INFO[0000] running docker cp                             bundles="[quay.io/kuiwang/depcatalogs:v1]"
INFO[0000] running docker rm                             bundles="[quay.io/kuiwang/depcatalogs:v1]"
INFO[0000] Could not find optional dependencies file     dir=bundle_tmp603802539 file=bundle_tmp603802539/metadata load=annotations
INFO[0000] found csv, loading bundle                     dir=bundle_tmp603802539 file=bundle_tmp603802539/manifests load=bundle
INFO[0000] loading bundle file                           dir=bundle_tmp603802539/manifests file=testoperatora-1-crd.yaml load=bundle
INFO[0000] loading bundle file                           dir=bundle_tmp603802539/manifests file=testoperatora-cm.yaml load=bundle
INFO[0000] loading bundle file                           dir=bundle_tmp603802539/manifests file=testoperatora-secret.yaml load=bundle
INFO[0000] loading bundle file                           dir=bundle_tmp603802539/manifests file=testoperatora-v1.0.0-csv.yaml load=bundle
INFO[0000] Generating dockerfile                         bundles="[quay.io/kuiwang/depcatalogs:v1]"
INFO[0000] writing dockerfile: index.Dockerfile854279505  bundles="[quay.io/kuiwang/depcatalogs:v1]"
INFO[0000] running docker build                          bundles="[quay.io/kuiwang/depcatalogs:v1]"
INFO[0000] [docker build -f index.Dockerfile854279505 -t quay.io/kuiwang/depcatalogs-index:1889388 .]  bundles="[quay.io/kuiwang/depcatalogs:v1]"
[root@preserve-olm-env operator-registry]# docker push quay.io/kuiwang/depcatalogs-index:1889388
The push refers to repository [quay.io/kuiwang/depcatalogs-index]
761e303630ec: Pushed
14d454bac30e: Layer already exists
7a12ba9c099a: Layer already exists
371d4702865c: Layer already exists
4570b0d18853: Layer already exists
ace0eda3e3be: Layer already exists
1889388: digest: sha256:ad501b7041cd27da103e6234a3eae36c95e569aac6e0c9e385a165ac08827049 size: 1577
[root@preserve-olm-env operator-registry]# ./bin/opm index add --bundles quay.io/kuiwang/depcatalogs:v11 --from-index quay.io/kuiwang/depcatalogs-index:1889388 --tag quay.io/kuiwang/depcatalogs-index:1889388 -c docker --mode=semver-skippatch
INFO[0000] building the index                            bundles="[quay.io/kuiwang/depcatalogs:v11]"
INFO[0000] Pulling previous image quay.io/kuiwang/depcatalogs-index:1889388 to get metadata  bundles="[quay.io/kuiwang/depcatalogs:v11]"
INFO[0000] running /usr/bin/docker pull quay.io/kuiwang/depcatalogs-index:1889388  bundles="[quay.io/kuiwang/depcatalogs:v11]"
INFO[0000] running /usr/bin/docker pull quay.io/kuiwang/depcatalogs-index:1889388  bundles="[quay.io/kuiwang/depcatalogs:v11]"
INFO[0001] Getting label data from previous image        bundles="[quay.io/kuiwang/depcatalogs:v11]"
INFO[0001] running docker inspect                        bundles="[quay.io/kuiwang/depcatalogs:v11]"
INFO[0001] running docker create                         bundles="[quay.io/kuiwang/depcatalogs:v11]"
INFO[0001] running docker cp                             bundles="[quay.io/kuiwang/depcatalogs:v11]"
INFO[0001] running docker rm                             bundles="[quay.io/kuiwang/depcatalogs:v11]"
INFO[0001] running /usr/bin/docker pull quay.io/kuiwang/depcatalogs:v11  bundles="[quay.io/kuiwang/depcatalogs:v11]"
INFO[0002] running docker create                         bundles="[quay.io/kuiwang/depcatalogs:v11]"
INFO[0002] running docker cp                             bundles="[quay.io/kuiwang/depcatalogs:v11]"
INFO[0002] running docker rm                             bundles="[quay.io/kuiwang/depcatalogs:v11]"
INFO[0002] Could not find optional dependencies file     dir=bundle_tmp991605342 file=bundle_tmp991605342/metadata load=annotations
INFO[0002] found csv, loading bundle                     dir=bundle_tmp991605342 file=bundle_tmp991605342/manifests load=bundle
INFO[0002] loading bundle file                           dir=bundle_tmp991605342/manifests file=testoperatora-1-crd.yaml load=bundle
INFO[0002] loading bundle file                           dir=bundle_tmp991605342/manifests file=testoperatora-cm.yaml load=bundle
INFO[0002] loading bundle file                           dir=bundle_tmp991605342/manifests file=testoperatora-secret.yaml load=bundle
INFO[0002] loading bundle file                           dir=bundle_tmp991605342/manifests file=testoperatora-v1.0.1-csv.yaml load=bundle
INFO[0002] Generating dockerfile                         bundles="[quay.io/kuiwang/depcatalogs:v11]"
INFO[0002] writing dockerfile: index.Dockerfile000528204  bundles="[quay.io/kuiwang/depcatalogs:v11]"
INFO[0002] running docker build                          bundles="[quay.io/kuiwang/depcatalogs:v11]"
INFO[0002] [docker build -f index.Dockerfile000528204 -t quay.io/kuiwang/depcatalogs-index:1889388 .]  bundles="[quay.io/kuiwang/depcatalogs:v11]"
[root@preserve-olm-env operator-registry]# docker push quay.io/kuiwang/depcatalogs-index:1889388
The push refers to repository [quay.io/kuiwang/depcatalogs-index]
11369449f137: Pushed
14d454bac30e: Layer already exists
7a12ba9c099a: Layer already exists
371d4702865c: Layer already exists
4570b0d18853: Layer already exists
ace0eda3e3be: Layer already exists
1889388: digest: sha256:23e587c8b0f002af07620feefff5443f998c6fee1448e069c64558a3c5a8d454 size: 1577
[root@preserve-olm-env operator-registry]#
[root@preserve-olm-env operator-registry]# cd ~/kuiwang/cases/1889388
[root@preserve-olm-env 1889388]# oc get pod -n openshift-operator-lifecycle-manager
NAME                                READY   STATUS    RESTARTS   AGE
catalog-operator-666d76887f-vnzvx   1/1     Running   0          4h25m
olm-operator-668995fc69-p89zg       1/1     Running   0          4h21m
packageserver-d6484d855-b58r4       1/1     Running   0          4h21m
packageserver-d6484d855-lng7r       1/1     Running   0          4h25m
[root@preserve-olm-env 1889388]#  oc exec catalog-operator-666d76887f-vnzvx -n openshift-operator-lifecycle-manager -- olm --version
OLM version: 0.17.0
git commit: 7988750a76c02530a72e77fff67705d4b2c0a9c9
[root@preserve-olm-env 1889388]# 

[root@preserve-olm-env 1889388]# cat tetcatsrc.yaml
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
  name: depcatalogs
  namespace: default
spec:
  displayName: "depcatalogs-semver-dep-nowork Operators"
  image: quay.io/kuiwang/depcatalogs-index:1889388
  publisher: IBM
  sourceType: grpc
[root@preserve-olm-env 1889388]# oc apply -f tetcatsrc.yaml
catalogsource.operators.coreos.com/depcatalogs created
[root@preserve-olm-env 1889388]# oc get pod
NAME                READY   STATUS    RESTARTS   AGE
depcatalogs-4xnlz   0/1     Running   0          8s
[root@preserve-olm-env 1889388]# oc get pod
NAME                READY   STATUS    RESTARTS   AGE
depcatalogs-4xnlz   1/1     Running   0          15s
[root@preserve-olm-env 1889388]# cat tetsub.yaml
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  name: testoperatorb
  namespace: default
spec:
  source: depcatalogs
  sourceNamespace: default

  channel: v1.0
  installPlanApproval: Automatic
  name: testoperatorb
  startingCSV: testoperatorb.v1.0.0
[root@preserve-olm-env 1889388]# oc apply -f tetsub.yaml
subscription.operators.coreos.com/testoperatorb created

[root@preserve-olm-env 1889388]# oc get pod -n openshift-operator-lifecycle-manager
NAME                                READY   STATUS    RESTARTS   AGE
catalog-operator-666d76887f-vnzvx   1/1     Running   0          4h27m
olm-operator-668995fc69-p89zg       1/1     Running   0          4h24m
packageserver-d6484d855-b58r4       1/1     Running   0          4h24m
packageserver-d6484d855-lng7r       1/1     Running   0          4h27m
[root@preserve-olm-env 1889388]# oc logs catalog-operator-666d76887f-vnzvx -n openshift-operator-lifecycle-manager
time="2020-11-18T01:17:38Z" level=info msg="log level info"
time="2020-11-18T01:17:38Z" level=info msg="TLS keys set, using https for metrics"
...
I1118 05:44:06.197719       1 event.go:278] Event(v1.ObjectReference{Kind:"Namespace", Namespace:"", Name:"default", UID:"115a248e-4752-44f2-943e-7724df6f2087", APIVersion:"v1", ResourceVersion:"511", FieldPath:""}): type: 'Warning' reason: 'ResolutionFailed' found multiple channel heads: [testoperatora.v1.0.1 testoperatora.v1.0.0], please check the `replaces`/`skipRange` fields of the operator bundles



--

Comment 10 kuiwang 2020-11-18 06:54:19 UTC
note:
og is created in default project
--
[root@preserve-olm-env 1889388]# cat og-single.yaml 
kind: OperatorGroup
apiVersion: operators.coreos.com/v1
metadata:
  name: og-single1
  namespace: default
spec:
  targetNamespaces:
  - default
[root@preserve-olm-env 1889388]# oc apply -f og-single.yaml 
operatorgroup.operators.coreos.com/og-single1 created

--

Comment 11 Ben Luddy 2020-11-18 15:15:46 UTC
This patch applies to the binaries inside the index image, not to the opm binary executed as part of "opm index add". Please make sure that you have the latest "quay.io/operator-framework/upstream-registry-builder:latest" image in your docker cache before running these opm index add commands.

Comment 12 kuiwang 2020-11-19 07:36:09 UTC
Hi Ben,

  Thanks. with latest quay.io/operator-framework/upstream-opm-builder:latest, not quay.io/operator-framework/upstream-registry-builder:latest because upstream-opm-builder is used to build index image per Dockerfile, LGTM on 4.7.

--
[root@preserve-olm-env bin]# docker pull quay.io/operator-framework/upstream-registry-builder:latest
latest: Pulling from operator-framework/upstream-registry-builder
188c0c94c7c5: Already exists 
538011b74a72: Pull complete 
f165f470e2ae: Pull complete 
ac1dff0b7c23: Pull complete 
Digest: sha256:d143b7525cd20e964f7ed66f26338bd46ebef6f63d33358e026bc01f4a9ac0fb
Status: Downloaded newer image for quay.io/operator-framework/upstream-registry-builder:latest
quay.io/operator-framework/upstream-registry-builder:latest

[root@preserve-olm-env operator-registry]# docker pull quay.io/operator-framework/upstream-opm-builder:latest
latest: Pulling from operator-framework/upstream-opm-builder
188c0c94c7c5: Already exists 
0b204e20a8c1: Pull complete 
e83dfb2924e7: Pull complete 
4e2a0be2db91: Pull complete 
7a7f3b7cc430: Pull complete 
Digest: sha256:29c37cb3fb32e03e46bc1c8b47fa490964e43a546cd1db0fdceced3b9c85239e
Status: Downloaded newer image for quay.io/operator-framework/upstream-opm-builder:latest
quay.io/operator-framework/upstream-opm-builder:latest



[root@preserve-olm-env operator-registry]# git log -n 1
commit fded0bf5ee59fb8d41188420956a64462fbe6823
Merge: 6ec440c 066dfe2
Author: OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>
Date:   Wed Nov 18 01:43:38 2020 +0100

    Merge pull request #509 from ankitathomas/dockerfile-version
    
    copy .git directory for build tag info
[root@preserve-olm-env operator-registry]# make clean
[root@preserve-olm-env operator-registry]# make build
GOFLAGS="-mod=vendor" go build  -tags "json1" -o bin/appregistry-server ./cmd/appregistry-server
GOFLAGS="-mod=vendor" go build  -tags "json1" -o bin/configmap-server ./cmd/configmap-server
GOFLAGS="-mod=vendor" go build  -tags "json1" -o bin/initializer ./cmd/initializer
GOFLAGS="-mod=vendor" go build  -tags "json1" -o bin/registry-server ./cmd/registry-server
GOFLAGS="-mod=vendor" go build -ldflags "-X 'github.com/operator-framework/operator-registry/cmd/opm/version.gitCommit=fded0bf' -X 'github.com/operator-framework/operator-registry/cmd/opm/version.opmVersion=v1.14.3-66-gfded0bf' -X 'github.com/operator-framework/operator-registry/cmd/opm/version.buildDate=2020-11-19T05:10:23Z'"  -tags "json1" -o bin/opm ./cmd/opm

[root@preserve-olm-env operator-registry]# grep "replaces" manifests/teiid-1889388/0.3.0/teiid.v0.3.0.clusterserviceversion.yaml 
[root@preserve-olm-env operator-registry]# grep "replaces" manifests/teiid-1889388/0.4.0/teiid.v0.4.0.clusterserviceversion.yaml 
[root@preserve-olm-env operator-registry]# 


[root@preserve-olm-env operator-registry]# ./bin/opm alpha bundle build --directory /root/kuiwang/operator-registry/manifests/teiid-1889388/0.3.0 --tag quay.io/kuiwang/teiid-operator:v1889388-3 -p teiid -c beta -e beta
INFO[0000] Building annotations.yaml                    
INFO[0000] Writing annotations.yaml in /root/kuiwang/operator-registry/manifests/teiid-1889388/metadata 
INFO[0000] Building Dockerfile                          
INFO[0000] Writing bundle.Dockerfile in /root/kuiwang/operator-registry 
INFO[0000] Building bundle image                        
Sending build context to Docker daemon  270.8MB
Step 1/9 : FROM scratch
 ---> 
Step 2/9 : LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
 ---> Using cache
 ---> 17f4d6cc02f6
Step 3/9 : LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
 ---> Using cache
 ---> ed5b62e609a0
Step 4/9 : LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
 ---> Using cache
 ---> 958a7490fbd5
Step 5/9 : LABEL operators.operatorframework.io.bundle.package.v1=teiid
 ---> Running in 1ebbd2669bb8
Removing intermediate container 1ebbd2669bb8
 ---> 660a23efdfcf
Step 6/9 : LABEL operators.operatorframework.io.bundle.channels.v1=beta
 ---> Running in 550f7fe6d39a
Removing intermediate container 550f7fe6d39a
 ---> c841860d7e05
Step 7/9 : LABEL operators.operatorframework.io.bundle.channel.default.v1=beta
 ---> Running in be1a9faf46cf
Removing intermediate container be1a9faf46cf
 ---> add28127624d
Step 8/9 : COPY manifests/teiid-1889388/0.3.0 /manifests/
 ---> 6096d94be701
Step 9/9 : COPY manifests/teiid-1889388/metadata /metadata/
 ---> e9c83c0e1a57
Successfully built e9c83c0e1a57
Successfully tagged quay.io/kuiwang/teiid-operator:v1889388-3
[root@preserve-olm-env operator-registry]# docker push quay.io/kuiwang/teiid-operator:v1889388-3
The push refers to repository [quay.io/kuiwang/teiid-operator]
1b01392952df: Pushed 
079b420c77c5: Pushed 
v1889388-3: digest: sha256:99d74b55abafd57bd4762987ca834aeb158b8c6e18f83611326e2ac086de8186 size: 733
[root@preserve-olm-env operator-registry]# rm -fr bundle.Dockerfile manifests/teiid-1889388/metadata/
[root@preserve-olm-env operator-registry]# ./bin/opm alpha bundle build --directory /root/kuiwang/operator-registry/manifests/teiid-1889388/0.4.0 --tag quay.io/kuiwang/teiid-operator:v1889388-4 -p teiid -c beta -e beta
INFO[0000] Building annotations.yaml                    
INFO[0000] Writing annotations.yaml in /root/kuiwang/operator-registry/manifests/teiid-1889388/metadata 
INFO[0000] Building Dockerfile                          
INFO[0000] Writing bundle.Dockerfile in /root/kuiwang/operator-registry 
INFO[0000] Building bundle image                        
Sending build context to Docker daemon  270.8MB
Step 1/9 : FROM scratch
 ---> 
Step 2/9 : LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
 ---> Using cache
 ---> 17f4d6cc02f6
Step 3/9 : LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
 ---> Using cache
 ---> ed5b62e609a0
Step 4/9 : LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
 ---> Using cache
 ---> 958a7490fbd5
Step 5/9 : LABEL operators.operatorframework.io.bundle.package.v1=teiid
 ---> Using cache
 ---> 660a23efdfcf
Step 6/9 : LABEL operators.operatorframework.io.bundle.channels.v1=beta
 ---> Using cache
 ---> c841860d7e05
Step 7/9 : LABEL operators.operatorframework.io.bundle.channel.default.v1=beta
 ---> Using cache
 ---> add28127624d
Step 8/9 : COPY manifests/teiid-1889388/0.4.0 /manifests/
 ---> 13bdfcea5ee9
Step 9/9 : COPY manifests/teiid-1889388/metadata /metadata/
 ---> ec71510339c5
Successfully built ec71510339c5
Successfully tagged quay.io/kuiwang/teiid-operator:v1889388-4
[root@preserve-olm-env operator-registry]# docker push quay.io/kuiwang/teiid-operator:v1889388-4
The push refers to repository [quay.io/kuiwang/teiid-operator]
88a40f8ae5bd: Pushed 
96f88f344c1a: Pushed 
v1889388-4: digest: sha256:288c57d56d0f67ca8ed241608c6e6cf76cba1f0c81ec012b8b1a43aecba66ae9 size: 733
[root@preserve-olm-env operator-registry]# rm -fr bundle.Dockerfile manifests/teiid-1889388/metadata/
[root@preserve-olm-env operator-registry]# 


[root@preserve-olm-env operator-registry]# ./bin/opm index add --bundles quay.io/kuiwang/teiid-operator:v1889388-3 --tag quay.io/kuiwang/teiid-index:1889388 -c docker --mode=semver-skippatch
INFO[0000] building the index                            bundles="[quay.io/kuiwang/teiid-operator:v1889388-3]"
INFO[0000] running /usr/bin/docker pull quay.io/kuiwang/teiid-operator:v1889388-3  bundles="[quay.io/kuiwang/teiid-operator:v1889388-3]"
INFO[0000] running docker create                         bundles="[quay.io/kuiwang/teiid-operator:v1889388-3]"
INFO[0000] running docker cp                             bundles="[quay.io/kuiwang/teiid-operator:v1889388-3]"
INFO[0000] running docker rm                             bundles="[quay.io/kuiwang/teiid-operator:v1889388-3]"
INFO[0000] Could not find optional dependencies file     dir=bundle_tmp218840626 file=bundle_tmp218840626/metadata load=annotations
INFO[0000] found csv, loading bundle                     dir=bundle_tmp218840626 file=bundle_tmp218840626/manifests load=bundle
INFO[0000] loading bundle file                           dir=bundle_tmp218840626/manifests file=teiid.io_virtualdatabases_crd.yaml load=bundle
INFO[0000] loading bundle file                           dir=bundle_tmp218840626/manifests file=teiid.v0.3.0.clusterserviceversion.yaml load=bundle
INFO[0000] Generating dockerfile                         bundles="[quay.io/kuiwang/teiid-operator:v1889388-3]"
INFO[0000] writing dockerfile: index.Dockerfile085037824  bundles="[quay.io/kuiwang/teiid-operator:v1889388-3]"
INFO[0000] running docker build                          bundles="[quay.io/kuiwang/teiid-operator:v1889388-3]"
INFO[0000] [docker build -f index.Dockerfile085037824 -t quay.io/kuiwang/teiid-index:1889388 .]  bundles="[quay.io/kuiwang/teiid-operator:v1889388-3]"
[root@preserve-olm-env operator-registry]# docker push quay.io/kuiwang/teiid-index:1889388
The push refers to repository [quay.io/kuiwang/teiid-index]
ca89b7c9ce70: Pushed 
b9f527aa3dfe: Mounted from kuiwang/depcatalogs-index 
f1a2e55eed80: Mounted from kuiwang/depcatalogs-index 
371d4702865c: Layer already exists 
4570b0d18853: Layer already exists 
ace0eda3e3be: Layer already exists 
1889388: digest: sha256:4c290e1afa7a76f4231fca169a2582dffcdbfb78954c10fb99aff3270f3da51d size: 1578
[root@preserve-olm-env operator-registry]# 

[root@preserve-olm-env operator-registry]# ./bin/opm index add --bundles quay.io/kuiwang/teiid-operator:v1889388-4 --from-index quay.io/kuiwang/teiid-index:1889388 --tag quay.io/kuiwang/teiid-index:1889388 -c docker --mode=semver-skippatch
INFO[0000] building the index                            bundles="[quay.io/kuiwang/teiid-operator:v1889388-4]"
INFO[0000] Pulling previous image quay.io/kuiwang/teiid-index:1889388 to get metadata  bundles="[quay.io/kuiwang/teiid-operator:v1889388-4]"
INFO[0000] running /usr/bin/docker pull quay.io/kuiwang/teiid-index:1889388  bundles="[quay.io/kuiwang/teiid-operator:v1889388-4]"
INFO[0000] running /usr/bin/docker pull quay.io/kuiwang/teiid-index:1889388  bundles="[quay.io/kuiwang/teiid-operator:v1889388-4]"
INFO[0001] Getting label data from previous image        bundles="[quay.io/kuiwang/teiid-operator:v1889388-4]"
INFO[0001] running docker inspect                        bundles="[quay.io/kuiwang/teiid-operator:v1889388-4]"
INFO[0001] running docker create                         bundles="[quay.io/kuiwang/teiid-operator:v1889388-4]"
INFO[0001] running docker cp                             bundles="[quay.io/kuiwang/teiid-operator:v1889388-4]"
INFO[0001] running docker rm                             bundles="[quay.io/kuiwang/teiid-operator:v1889388-4]"
INFO[0001] running /usr/bin/docker pull quay.io/kuiwang/teiid-operator:v1889388-4  bundles="[quay.io/kuiwang/teiid-operator:v1889388-4]"
INFO[0002] running docker create                         bundles="[quay.io/kuiwang/teiid-operator:v1889388-4]"
INFO[0002] running docker cp                             bundles="[quay.io/kuiwang/teiid-operator:v1889388-4]"
INFO[0002] running docker rm                             bundles="[quay.io/kuiwang/teiid-operator:v1889388-4]"
INFO[0002] Could not find optional dependencies file     dir=bundle_tmp762372425 file=bundle_tmp762372425/metadata load=annotations
INFO[0002] found csv, loading bundle                     dir=bundle_tmp762372425 file=bundle_tmp762372425/manifests load=bundle
INFO[0002] loading bundle file                           dir=bundle_tmp762372425/manifests file=teiid.io_virtualdatabases_crd.yaml load=bundle
INFO[0002] loading bundle file                           dir=bundle_tmp762372425/manifests file=teiid.v0.4.0.clusterserviceversion.yaml load=bundle
INFO[0002] Generating dockerfile                         bundles="[quay.io/kuiwang/teiid-operator:v1889388-4]"
INFO[0002] writing dockerfile: index.Dockerfile699613375  bundles="[quay.io/kuiwang/teiid-operator:v1889388-4]"
INFO[0002] running docker build                          bundles="[quay.io/kuiwang/teiid-operator:v1889388-4]"
INFO[0002] [docker build -f index.Dockerfile699613375 -t quay.io/kuiwang/teiid-index:1889388 .]  bundles="[quay.io/kuiwang/teiid-operator:v1889388-4]"
[root@preserve-olm-env operator-registry]# docker push quay.io/kuiwang/teiid-index:1889388
The push refers to repository [quay.io/kuiwang/teiid-index]
604f1fcfa86d: Pushed 
b9f527aa3dfe: Layer already exists 
f1a2e55eed80: Layer already exists 
371d4702865c: Layer already exists 
4570b0d18853: Layer already exists 
ace0eda3e3be: Layer already exists 
1889388: digest: sha256:c57289a67facfc3b8d6e142ef5144b7cea45e3ffeec8f79415b983a39e8984a1 size: 1578


[root@preserve-olm-env operator-registry]# cd ~/kuiwang/cases/1889388
[root@preserve-olm-env 1889388]# oc get pod -n openshift-operator-lifecycle-manager
NAME                                READY   STATUS    RESTARTS   AGE
catalog-operator-666d76887f-lbcxw   1/1     Running   0          5h47m
olm-operator-668995fc69-sxjtk       1/1     Running   0          5h47m
packageserver-85b685c4c-pj7dd       1/1     Running   0          5h44m
packageserver-85b685c4c-tb4hp       1/1     Running   0          5h47m
[root@preserve-olm-env 1889388]# oc exec catalog-operator-666d76887f-lbcxw -n openshift-operator-lifecycle-manager -- olm --version
OLM version: 0.17.0
git commit: 7988750a76c02530a72e77fff67705d4b2c0a9c9

[root@preserve-olm-env 1889388]# cat teiidcatsrc.yaml 
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
  name: teiid
  namespace: default
spec:
  displayName: "teiid Operators"
  image: quay.io/kuiwang/teiid-index:1889388
  publisher: QE
  sourceType: grpc
[root@preserve-olm-env 1889388]# oc apply -f teiidcatsrc.yaml 
catalogsource.operators.coreos.com/teiid created
[root@preserve-olm-env 1889388]# oc get pod
NAME          READY   STATUS              RESTARTS   AGE
teiid-6p9rf   0/1     ContainerCreating   0          4s
[root@preserve-olm-env 1889388]# oc get pod
NAME          READY   STATUS    RESTARTS   AGE
teiid-6p9rf   1/1     Running   0          2m22s
[root@preserve-olm-env 1889388]# cat og-single.yaml 
kind: OperatorGroup
apiVersion: operators.coreos.com/v1
metadata:
  name: og-single1
  namespace: default
spec:
  targetNamespaces:
  - default
[root@preserve-olm-env 1889388]# oc apply -f og-single.yaml 
operatorgroup.operators.coreos.com/og-single1 created
[root@preserve-olm-env 1889388]# cat teiidsub.yaml 
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  name: teiid
  namespace: default
spec:
  source: teiid
  sourceNamespace: default

  channel: beta
  installPlanApproval: Automatic
  name: teiid
  startingCSV: teiid.v0.3.0
[root@preserve-olm-env 1889388]# oc apply -f teiidsub.yaml 
subscription.operators.coreos.com/teiid created
[root@preserve-olm-env 1889388]# 

[root@preserve-olm-env 1889388]# oc get ip
NAME            CSV            APPROVAL    APPROVED
install-j5rxp   teiid.v0.3.0   Automatic   true
[root@preserve-olm-env 1889388]# oc get csv
No resources found in default namespace.
[root@preserve-olm-env 1889388]# oc get csv
NAME           DISPLAY   VERSION   REPLACES   PHASE
teiid.v0.3.0   Teiid     0.3.0                Installing
[root@preserve-olm-env 1889388]# oc get csv
NAME           DISPLAY   VERSION   REPLACES       PHASE
teiid.v0.3.0   Teiid     0.3.0                    Replacing
teiid.v0.4.0   Teiid     0.4.0     teiid.v0.3.0   Installing
[root@preserve-olm-env 1889388]# oc get csv
NAME           DISPLAY   VERSION   REPLACES       PHASE
teiid.v0.4.0   Teiid     0.4.0     teiid.v0.3.0   Succeeded
[root@preserve-olm-env 1889388]# 


--


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