Bug 1796675 - `oc adm catalog build` should immediately error out if it can't find any data in appregistry [NEEDINFO]
Summary: `oc adm catalog build` should immediately error out if it can't find any data...
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: OLM
Version: 4.3.z
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
: 4.3.z
Assignee: Bowen Song
QA Contact: Jian Zhang
Depends On: 1804554
TreeView+ depends on / blocked
Reported: 2020-01-30 22:47 UTC by Evan Cordell
Modified: 2020-07-08 00:56 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1790785
Last Closed: 2020-03-24 14:32:35 UTC
Target Upstream Version:
jiazha: needinfo? (ecordell)

Attachments (Terms of Use)

System ID Private Priority Status Summary Last Updated
Github openshift oc pull 336 0 None closed [release-4.3] Bug 1796675: bump(operator-framework/operator-registry) 2020-07-08 00:54:29 UTC
Red Hat Product Errata RHBA-2020:0858 0 None None None 2020-03-24 14:33:02 UTC

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:

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]} 
[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
  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.


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