Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1796675

Summary: `oc adm catalog build` should immediately error out if it can't find any data in appregistry
Product: OpenShift Container Platform Reporter: Evan Cordell <ecordell>
Component: OLMAssignee: Bowen Song <bsong>
OLM sub component: OLM QA Contact: Jian Zhang <jiazha>
Status: CLOSED ERRATA Docs Contact:
Severity: low    
Priority: high CC: jiazha, kuiwang, nhale
Version: 4.3.z   
Target Milestone: ---   
Target Release: 4.3.z   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1790785 Environment:
Last Closed: 2020-03-24 14:32:35 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: 1804554    
Bug Blocks:    

Description Evan Cordell 2020-01-30 22:47:47 UTC
+++ This bug was initially created as a clone of Bug #1790785 +++

Description of problem:
No error report when the `oc adm catalog build` gets none data.


Version-Release number of selected component (if applicable):
Cluster version is: 4.3.0-0.nightly-2020-01-14-000626 
[jzhang@dhcp-140-36 ~]$ oc version
Client Version: 4.3.0-0.nightly-2020-01-14-000626
Server Version: 4.3.0-0.nightly-2020-01-14-000626
Kubernetes Version: v1.16.2

How reproducible:
always

Steps to Reproduce:
1. Create an OCP 4.3.

2. Enable the cluster registry.
[jzhang@dhcp-140-36 ~]$ oc patch configs.imageregistry.operator.openshift.io/cluster -p='{"spec":{"defaultRoute":true}}' --type=merge
config.imageregistry.operator.openshift.io/cluster patched
[jzhang@dhcp-140-36 ~]$ oc get images.config.openshift.io/cluster  -o jsonpath={.status.externalRegistryHostnames[0]} 
default-route-openshift-image-registry.apps.qe-jiazha-dis.qe.devcluster.openshift.com
[jzhang@dhcp-140-36 ~]$ oc get secret router-certs-default -n openshift-ingress -o json |jq -r '.data["tls.crt"]' | base64 -d | sudo tee /etc/pki/ca-trust/source/anchors/disconnected.crt
[jzhang@dhcp-140-36 ~]$ sudo update-ca-trust 
[jzhang@dhcp-140-36 ~]$ oc create serviceaccount registry
serviceaccount/registry created
[jzhang@dhcp-140-36 ~]$ oc adm policy add-cluster-role-to-user admin -z registry
clusterrole.rbac.authorization.k8s.io/admin added: "registry"
[jzhang@dhcp-140-36 ~]$ docker login default-route-openshift-image-registry.apps.qe-jiazha-dis.qe.devcluster.openshift.com -u reegistry -p `oc sa get-token registry`

3. Run "oc adm catalog build xxx", like below:
[jzhang@dhcp-140-36 ~]$ oc adm catalog build --appregistry-org=redhat-operators-art --to=default-route-openshift-image-registry.apps.qe-jiazha-dis.qe.devcluster.openshift.com/openshift/olm:v1 

Actual results:
The "oc adm catalog build" runs successfully, no errors out.
[jzhang@dhcp-140-36 ~]$ oc adm catalog build --appregistry-org=redhat-operators-art --auth-token="xxx"(replace real token with xxx) --to=default-route-openshift-image-registry.apps.qe-jiazha-dis.qe.devcluster.openshift.com/openshift/olm:v1 
INFO[0001] loading Bundles                               dir=/tmp/manifests-445659376
INFO[0001] directory                                     dir=/tmp/manifests-445659376 file=manifests-445659376 load=bundles
INFO[0001] loading Packages and Entries                  dir=/tmp/manifests-445659376
INFO[0001] directory                                     dir=/tmp/manifests-445659376 file=manifests-445659376 load=package
Uploading ... 471.6B/s
Uploading 3.405MB ...
Uploading 9.833MB ...
Pushed sha256:18958ad670fc84e93e4149b933eaa6173adb22a4e2dfc70f0db84b36ee0d1bb2 to default-route-openshift-image-registry.apps.qe-jiazha-dis.qe.devcluster.openshift.com/openshift/olm:v1


Expected results:
Since this redhat-operators-art is a private repo, the "oc adm catalog build" cannot get any data, but it should report errors immediately.

Additional info:

Comment 7 Jian Zhang 2020-03-11 05:35:20 UTC
1, Install a `oc` that contains the fixed PR, as follows:
[jzhang@dhcp-140-36 4.3]$ ./oc version -o yaml
clientVersion:
  buildDate: "2020-03-10T13:11:25Z"
  compiler: gc
  gitCommit: 79a17e70404a12c4259550465659107e4524ecee
  gitTreeState: clean
  gitVersion: openshift-clients-4.3.6-202003090404
  goVersion: go1.12.12
  major: ""
  minor: ""
  platform: linux/amd64
releaseClientVersion: 4.3.0-0.nightly-2020-03-10-182422
...

2, Run "oc adm catalog build xxx", like below:

[jzhang@dhcp-140-36 4.3]$ ./oc adm catalog build --appregistry-org=redhat-operators-art --to localhost:5000/olm/test:v1
error: no manifests downloaded from appregistry https://quay.io/cnr/redhat-operators-art

Get the error report timely, LGTM, verify it.

Comment 9 errata-xmlrpc 2020-03-24 14:32:35 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:0858

Comment 10 Red Hat Bugzilla 2023-09-14 05:50:57 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 1000 days