Bug 1882807

Summary: opm alpha bundle build / generate should not use skiprange to infer channels
Product: OpenShift Container Platform Reporter: lgallett
Component: OLMAssignee: lgallett
OLM sub component: OLM QA Contact: kuiwang
Status: CLOSED ERRATA Docs Contact:
Severity: medium    
Priority: high CC: ecordell
Version: 4.6   
Target Milestone: ---   
Target Release: 4.6.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-10-27 16:45:38 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description lgallett 2020-09-25 18:17:16 UTC
Description of problem:

Given the following graph:
stable:
1.0.1 -> 1.0.0 - skiprange < 0.0.2
alpha:
0.0.2 -> 0.0.1

running opm alpha bundle generate / build on 0.0.1 and 0.0.2 will set in their annotations.yaml file channels "alpha,stable" when it should only be "stable"


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

latest

How reproducible:

always

Steps to Reproduce:
1. create bundles using opm alpha bundle build from https://github.com/operator-framework/operator-registry/tree/master/test/e2e/testdata/aqua
2. notice the channels in the annotations.yaml

Actual results:

channels "alpha,beta,stable"

Expected results:

channels "beta"

Comment 2 kuiwang 2020-09-27 05:59:44 UTC
Verify it. LGTM

--
[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=e8dbb71' -X 'github.com/operator-framework/operator-registry/cmd/opm/version.opmVersion=v1.14.2-2-ge8dbb71' -X 'github.com/operator-framework/operator-registry/cmd/opm/version.buildDate=2020-09-27T05:41:29Z'"  -tags "json1" -o bin/opm ./cmd/opm
[root@preserve-olm-env operator-registry]# bin/opm version
Version: version.Version{OpmVersion:"v1.14.2-2-ge8dbb71", GitCommit:"e8dbb71", BuildDate:"2020-09-27T05:41:29Z", GoOs:"linux", GoArch:"amd64"}
[root@preserve-olm-env operator-registry]# ./bin/opm alpha bundle build --directory /root/kuiwang/operator-registry/test/e2e/testdata/aqua/0.0.1 --tag quay.io/kuiwang/aqua:0.0.1 --package aqua
INFO[0000] Bundle channels information not provided, inferring from parent package directory 
INFO[0000] Inferred channels: beta                      
INFO[0000] Inferred default channel: stable             
INFO[0000] Building annotations.yaml                    
INFO[0000] Writing annotations.yaml in /root/kuiwang/operator-registry/test/e2e/testdata/aqua/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  105.1MB
Step 1/9 : FROM scratch
 ---> 
Step 2/9 : LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
 ---> Using cache
 ---> 7e95ac289bf7
Step 3/9 : LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
 ---> Using cache
 ---> c7798578d997
Step 4/9 : LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
 ---> Using cache
 ---> a4cf559f3fb0
Step 5/9 : LABEL operators.operatorframework.io.bundle.package.v1=aqua
 ---> Using cache
 ---> e535457dc06c
Step 6/9 : LABEL operators.operatorframework.io.bundle.channels.v1=beta
 ---> Using cache
 ---> 5bfad956219f
Step 7/9 : LABEL operators.operatorframework.io.bundle.channel.default.v1=stable
 ---> Using cache
 ---> c58c3d59277c
Step 8/9 : COPY test/e2e/testdata/aqua/0.0.1 /manifests/
 ---> 75a54e78550f
Step 9/9 : COPY test/e2e/testdata/aqua/metadata /metadata/
 ---> 12ef6ab43fef
Successfully built 12ef6ab43fef
Successfully tagged quay.io/kuiwang/aqua:0.0.1
[root@preserve-olm-env operator-registry]# cat test/e2e/testdata/aqua/metadata/annotations.yaml |grep bundle.channels
  operators.operatorframework.io.bundle.channels.v1: beta
[root@preserve-olm-env operator-registry]# rm -fr bundle.Dockerfile test/e2e/testdata/aqua/metadata

[root@preserve-olm-env operator-registry]# ./bin/opm alpha bundle generate --directory /root/kuiwang/operator-registry/test/e2e/testdata/aqua/0.0.1 -u ./aqua  --package aqua
INFO[0000] Bundle channels information not provided, inferring from parent package directory 
INFO[0000] Inferred channels: beta                      
INFO[0000] Inferred default channel: stable             
INFO[0000] Building annotations.yaml                    
INFO[0000] Generating output manifests directory        
INFO[0000] Writing annotations.yaml in /root/kuiwang/operator-registry/aqua/metadata 
INFO[0000] Building Dockerfile                          
INFO[0000] Writing bundle.Dockerfile in /root/kuiwang/operator-registry 

[root@preserve-olm-env operator-registry]# cat aqua/metadata/annotations.yaml |grep bundle.channels
  operators.operatorframework.io.bundle.channels.v1: beta
[root@preserve-olm-env operator-registry]# rm -fr bundle.Dockerfile aqua/

[root@preserve-olm-env operator-registry]# ./bin/opm alpha bundle build --directory /root/kuiwang/operator-registry/test/e2e/testdata/aqua/0.0.2 --tag quay.io/kuiwang/aqua:0.0.2 --package aqua
INFO[0000] Bundle channels information not provided, inferring from parent package directory 
INFO[0000] Inferred channels: beta                      
INFO[0000] Inferred default channel: stable             
INFO[0000] Building annotations.yaml                    
INFO[0000] Writing annotations.yaml in /root/kuiwang/operator-registry/test/e2e/testdata/aqua/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  105.1MB
Step 1/9 : FROM scratch
 ---> 
Step 2/9 : LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
 ---> Using cache
 ---> 7e95ac289bf7
Step 3/9 : LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
 ---> Using cache
 ---> c7798578d997
Step 4/9 : LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
 ---> Using cache
 ---> a4cf559f3fb0
Step 5/9 : LABEL operators.operatorframework.io.bundle.package.v1=aqua
 ---> Using cache
 ---> e535457dc06c
Step 6/9 : LABEL operators.operatorframework.io.bundle.channels.v1=beta
 ---> Using cache
 ---> 5bfad956219f
Step 7/9 : LABEL operators.operatorframework.io.bundle.channel.default.v1=stable
 ---> Using cache
 ---> c58c3d59277c
Step 8/9 : COPY test/e2e/testdata/aqua/0.0.2 /manifests/
 ---> Using cache
 ---> fcb379227302
Step 9/9 : COPY test/e2e/testdata/aqua/metadata /metadata/
 ---> Using cache
 ---> dcbd8bdd06ab
Successfully built dcbd8bdd06ab
Successfully tagged quay.io/kuiwang/aqua:0.0.2
[root@preserve-olm-env operator-registry]# cat test/e2e/testdata/aqua/metadata/annotations.yaml |grep bundle.channels
  operators.operatorframework.io.bundle.channels.v1: beta
[root@preserve-olm-env operator-registry]# rm -fr bundle.Dockerfile test/e2e/testdata/aqua/metadata
[root@preserve-olm-env operator-registry]# ./bin/opm alpha bundle generate --directory /root/kuiwang/operator-registry/test/e2e/testdata/aqua/0.0.2 -u ./aqua  --package aqua
INFO[0000] Bundle channels information not provided, inferring from parent package directory 
INFO[0000] Inferred channels: beta                      
INFO[0000] Inferred default channel: stable             
INFO[0000] Building annotations.yaml                    
INFO[0000] Generating output manifests directory        
INFO[0000] Writing annotations.yaml in /root/kuiwang/operator-registry/aqua/metadata 
INFO[0000] Building Dockerfile                          
INFO[0000] Writing bundle.Dockerfile in /root/kuiwang/operator-registry 
[root@preserve-olm-env operator-registry]# cat aqua/metadata/annotations.yaml |grep bundle.channels
  operators.operatorframework.io.bundle.channels.v1: beta
[root@preserve-olm-env operator-registry]# rm -fr bundle.Dockerfile aqua/
--

Comment 5 errata-xmlrpc 2020-10-27 16:45:38 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