Bug 1892360

Summary: ListBundles returns incorrect replaces/skips when bundles have been added via semver-skippatch mode
Product: OpenShift Container Platform Reporter: OpenShift BugZilla Robot <openshift-bugzilla-robot>
Component: OLMAssignee: Ben Luddy <bluddy>
OLM sub component: OLM QA Contact: kuiwang
Status: CLOSED ERRATA Docs Contact:
Severity: high    
Priority: high CC: bluddy, cdjohnson, nhale, vdinh
Version: 4.7   
Target Milestone: ---   
Target Release: 4.6.z   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1902803 (view as bug list) Environment:
Last Closed: 2020-11-30 16:45:31 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: 1889388    
Bug Blocks: 1902803    

Comment 4 kuiwang 2020-11-23 02:43:16 UTC
verify it on 4.6. LGTM

--
[root@preserve-olm-env operator-registry]# git log -n 3
commit d1f14850944948e7ccdb5be0e57619e2a98acb20
Merge: bd95197 fec8100
Author: OpenShift Merge Robot <openshift-merge-robot.github.com>
Date:   Fri Nov 20 21:46:08 2020 +0100

    Merge pull request #488 from openshift-cherrypick-robot/cherry-pick-486-to-release-4.6
    
    [release-4.6] Bug 1891064: Check prerelease version for semver-skippatch mode

commit bd951973f234dcffde1b7287773204467fcd35b1
Merge: 0e2178b 0c43ef0
Author: OpenShift Merge Robot <openshift-merge-robot.github.com>
Date:   Fri Nov 20 18:57:44 2020 +0100

    Merge pull request #520 from benluddy/listbundles-multiple-incoming-edges-46
    
    Bug 1892360: Reconstruct replaces/splits for Listbundles from channel_entry.

commit fec8100005db2e8dedb8a429015428448c7fc2af
Author: Ankita Thomas <ankithom>
Date:   Tue Nov 3 13:37:28 2020 -0500

    add skippatch unit test
[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=d1f1485' -X 'github.com/operator-framework/operator-registry/cmd/opm/version.opmVersion=v1.14.3-16-gd1f1485' -X 'github.com/operator-framework/operator-registry/cmd/opm/version.buildDate=2020-11-23T01:32:12Z'"  -tags "json1" -o bin/opm ./cmd/opm
[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:v1892360-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  269.7MB
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.3.0 /manifests/
 ---> Using cache
 ---> 6096d94be701
Step 9/9 : COPY manifests/teiid-1889388/metadata /metadata/
 ---> Using cache
 ---> e9c83c0e1a57
Successfully built e9c83c0e1a57
Successfully tagged quay.io/kuiwang/teiid-operator:v1892360-3
[root@preserve-olm-env operator-registry]# docker push quay.io/kuiwang/teiid-operator:v1892360-3
The push refers to repository [quay.io/kuiwang/teiid-operator]
1b01392952df: Layer already exists 
079b420c77c5: Layer already exists 
v1892360-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]# 



[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:v1892360-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  269.7MB
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/
 ---> Using cache
 ---> 13bdfcea5ee9
Step 9/9 : COPY manifests/teiid-1889388/metadata /metadata/
 ---> Using cache
 ---> ec71510339c5
Successfully built ec71510339c5
Successfully tagged quay.io/kuiwang/teiid-operator:v1892360-4
[root@preserve-olm-env operator-registry]# docker push quay.io/kuiwang/teiid-operator:v1892360-4
The push refers to repository [quay.io/kuiwang/teiid-operator]
88a40f8ae5bd: Layer already exists 
96f88f344c1a: Layer already exists 
v1892360-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]# docker pull quay.io/operator-framework/upstream-opm-builder:latest
latest: Pulling from operator-framework/upstream-opm-builder
188c0c94c7c5: Already exists 
0b204e20a8c1: Already exists 
e83dfb2924e7: Already exists 
45cd69ff41ea: Pull complete 
aa1d09072e84: Pull complete 
Digest: sha256:768eb0267f94484dc31a73ce8f0fe190d01fd5c2eaeff57d9a23588e06e047e5
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]# 


[root@preserve-olm-env operator-registry]# ./bin/opm index add --bundles quay.io/kuiwang/teiid-operator:v1892360-3 --tag quay.io/kuiwang/teiid-index:1892360 -c docker --mode=semver-skippatch
INFO[0000] building the index                            bundles="[quay.io/kuiwang/teiid-operator:v1892360-3]"
INFO[0000] running /usr/bin/docker pull quay.io/kuiwang/teiid-operator:v1892360-3  bundles="[quay.io/kuiwang/teiid-operator:v1892360-3]"
INFO[0000] running docker create                         bundles="[quay.io/kuiwang/teiid-operator:v1892360-3]"
INFO[0000] running docker cp                             bundles="[quay.io/kuiwang/teiid-operator:v1892360-3]"
INFO[0000] running docker rm                             bundles="[quay.io/kuiwang/teiid-operator:v1892360-3]"
INFO[0000] Could not find optional dependencies file     dir=bundle_tmp274224959 file=bundle_tmp274224959/metadata load=annotations
INFO[0000] found csv, loading bundle                     dir=bundle_tmp274224959 file=bundle_tmp274224959/manifests load=bundle
INFO[0000] loading bundle file                           dir=bundle_tmp274224959/manifests file=teiid.io_virtualdatabases_crd.yaml load=bundle
INFO[0000] loading bundle file                           dir=bundle_tmp274224959/manifests file=teiid.v0.3.0.clusterserviceversion.yaml load=bundle
INFO[0000] Generating dockerfile                         bundles="[quay.io/kuiwang/teiid-operator:v1892360-3]"
INFO[0000] writing dockerfile: index.Dockerfile579683525  bundles="[quay.io/kuiwang/teiid-operator:v1892360-3]"
INFO[0000] running docker build                          bundles="[quay.io/kuiwang/teiid-operator:v1892360-3]"
INFO[0000] [docker build -f index.Dockerfile579683525 -t quay.io/kuiwang/teiid-index:1892360 .]  bundles="[quay.io/kuiwang/teiid-operator:v1892360-3]"
[root@preserve-olm-env operator-registry]# docker push quay.io/kuiwang/teiid-index:1892360
The push refers to repository [quay.io/kuiwang/teiid-index]
48ba8303841d: Pushed 
fbe39d558281: Mounted from operator-framework/upstream-opm-builder 
e105a1e44712: Mounted from operator-framework/upstream-opm-builder 
371d4702865c: Layer already exists 
4570b0d18853: Layer already exists 
ace0eda3e3be: Layer already exists 
1892360: digest: sha256:fe033e1a238c84cb4b5538c6ddb307cf1e8faf64df238b6573d595fb51b330f5 size: 1578
[root@preserve-olm-env operator-registry]# ./bin/opm index add --bundles quay.io/kuiwang/teiid-operator:v1892360-4 --from-index quay.io/kuiwang/teiid-index:1892360 --tag quay.io/kuiwang/teiid-index:1892360 -c docker --mode=semver-skippatch
INFO[0000] building the index                            bundles="[quay.io/kuiwang/teiid-operator:v1892360-4]"
INFO[0000] Pulling previous image quay.io/kuiwang/teiid-index:1892360 to get metadata  bundles="[quay.io/kuiwang/teiid-operator:v1892360-4]"
INFO[0000] running /usr/bin/docker pull quay.io/kuiwang/teiid-index:1892360  bundles="[quay.io/kuiwang/teiid-operator:v1892360-4]"
INFO[0000] running /usr/bin/docker pull quay.io/kuiwang/teiid-index:1892360  bundles="[quay.io/kuiwang/teiid-operator:v1892360-4]"
INFO[0001] Getting label data from previous image        bundles="[quay.io/kuiwang/teiid-operator:v1892360-4]"
INFO[0001] running docker inspect                        bundles="[quay.io/kuiwang/teiid-operator:v1892360-4]"
INFO[0001] running docker create                         bundles="[quay.io/kuiwang/teiid-operator:v1892360-4]"
INFO[0001] running docker cp                             bundles="[quay.io/kuiwang/teiid-operator:v1892360-4]"
INFO[0001] running docker rm                             bundles="[quay.io/kuiwang/teiid-operator:v1892360-4]"
INFO[0001] running /usr/bin/docker pull quay.io/kuiwang/teiid-operator:v1892360-4  bundles="[quay.io/kuiwang/teiid-operator:v1892360-4]"
INFO[0002] running docker create                         bundles="[quay.io/kuiwang/teiid-operator:v1892360-4]"
INFO[0002] running docker cp                             bundles="[quay.io/kuiwang/teiid-operator:v1892360-4]"
INFO[0002] running docker rm                             bundles="[quay.io/kuiwang/teiid-operator:v1892360-4]"
INFO[0002] Could not find optional dependencies file     dir=bundle_tmp144376375 file=bundle_tmp144376375/metadata load=annotations
INFO[0002] found csv, loading bundle                     dir=bundle_tmp144376375 file=bundle_tmp144376375/manifests load=bundle
INFO[0002] loading bundle file                           dir=bundle_tmp144376375/manifests file=teiid.io_virtualdatabases_crd.yaml load=bundle
INFO[0002] loading bundle file                           dir=bundle_tmp144376375/manifests file=teiid.v0.4.0.clusterserviceversion.yaml load=bundle
INFO[0002] Generating dockerfile                         bundles="[quay.io/kuiwang/teiid-operator:v1892360-4]"
INFO[0002] writing dockerfile: index.Dockerfile282213117  bundles="[quay.io/kuiwang/teiid-operator:v1892360-4]"
INFO[0002] running docker build                          bundles="[quay.io/kuiwang/teiid-operator:v1892360-4]"
INFO[0002] [docker build -f index.Dockerfile282213117 -t quay.io/kuiwang/teiid-index:1892360 .]  bundles="[quay.io/kuiwang/teiid-operator:v1892360-4]"
[root@preserve-olm-env operator-registry]# docker push quay.io/kuiwang/teiid-index:1892360
The push refers to repository [quay.io/kuiwang/teiid-index]
14849655146b: Pushed 
fbe39d558281: Layer already exists 
e105a1e44712: Layer already exists 
371d4702865c: Layer already exists 
4570b0d18853: Layer already exists 
ace0eda3e3be: Layer already exists 
1892360: digest: sha256:5cd3ac8425b62eea78e8da4ed57cf5c6b33fe7c53df9572f40b933986ac725fc size: 1578
[root@preserve-olm-env operator-registry]# 

[root@preserve-olm-env 1892360]# oc get pod -n openshift-operator-lifecycle-manager
NAME                                READY   STATUS    RESTARTS   AGE
catalog-operator-79b84f5f77-999br   1/1     Running   0          18m
olm-operator-5bddb4549f-2v6rf       1/1     Running   0          18m
packageserver-85b744db79-2mjtm      1/1     Running   0          18m
packageserver-85b744db79-w4bx4      1/1     Running   0          21m
[root@preserve-olm-env 1892360]# oc exec catalog-operator-79b84f5f77-999br -n openshift-operator-lifecycle-manager -- olm --version
OLM version: 0.16.1
git commit: f754da683a76e2f0f7fe0cd08b96f925c4a24cb2

[root@preserve-olm-env 1892360]# 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:1892360
  publisher: QE
  sourceType: grpc
[root@preserve-olm-env 1892360]# oc apply -f teiidcatsrc.yaml
catalogsource.operators.coreos.com/teiid created
[root@preserve-olm-env 1892360]# oc get pod
NAME          READY   STATUS    RESTARTS   AGE
teiid-hdkv5   0/1     Running   0          8s
[root@preserve-olm-env 1892360]# oc get pod
NAME          READY   STATUS    RESTARTS   AGE
teiid-hdkv5   0/1     Running   0          11s
[root@preserve-olm-env 1892360]# oc get pod
NAME          READY   STATUS    RESTARTS   AGE
teiid-hdkv5   1/1     Running   0          22s
[root@preserve-olm-env 1892360]#  cat og-single.yaml 
kind: OperatorGroup
apiVersion: operators.coreos.com/v1
metadata:
  name: og-single1
  namespace: default
spec:
  targetNamespaces:
  - default
[root@preserve-olm-env 1892360]# oc apply -f og-single.yaml 
operatorgroup.operators.coreos.com/og-single1 created
[root@preserve-olm-env 1892360]# 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 1892360]# oc apply -f teiidsub.yaml
subscription.operators.coreos.com/teiid created
[root@preserve-olm-env 1892360]# oc get ip
NAME            CSV            APPROVAL    APPROVED
install-kd8wb   teiid.v0.3.0   Automatic   true
[root@preserve-olm-env 1892360]# oc get csv
No resources found in default namespace.
[root@preserve-olm-env 1892360]# oc get csv
No resources found in default namespace.
[root@preserve-olm-env 1892360]# 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 1892360]# 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 1892360]# 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 1892360]# 

--

Comment 7 errata-xmlrpc 2020-11-30 16:45:31 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.6 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/RHBA-2020:5115