Bug 2039135 - the error message is not clear when using "opm index prune" to prune a file-based index image
Summary: the error message is not clear when using "opm index prune" to prune a file-b...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: OLM
Version: 4.10
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: 4.11.0
Assignee: Per da Silva
QA Contact: xzha
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-01-11 03:28 UTC by xzha
Modified: 2022-10-11 09:34 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: Unhelpful error message when running OPM index prune against a File-Based Catalog image Consequence: User confusion Fix: Improved the error message to make clear to the user that OPM index prune is only valid for SQLite-based images Result: User understands that this command is not for File-Based Catalog images
Clone Of:
Environment:
Last Closed: 2022-08-10 10:41:42 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift operator-framework-olm pull 308 0 None open Bug 2039135: add more descriptive error message to pruning of FBC 2022-05-18 20:24:47 UTC
Red Hat Product Errata RHSA-2022:5069 0 None None None 2022-08-10 10:42:09 UTC

Description xzha 2022-01-11 03:28:35 UTC
Description of problem:
the error message "opm index prune" a file-based index image is not clear, the message "Error: index image xxxx missing label operators.operatorframework.io.index.database.v1" is confusing.

Version-Release number of selected component (if applicable):
[root@preserve-olm-agent-test ~]# opm version
Version: version.Version{OpmVersion:"13f7723ba", GitCommit:"13f7723ba6098a17c7c44da17d844bb0d87d30a7", BuildDate:"2021-12-29T01:32:43Z", GoOs:"linux", GoArch:"amd64"}

How reproducible:
always

Steps to Reproduce:
[root@preserve-olm-agent-test ~]# opm alpha list packages quay.io/olmqe/etcd-index:47322-single
NAME            DISPLAY NAME   DEFAULT CHANNEL
ditto-operator  Eclipse Ditto  v2.0
etcd            etcd           alpha-1

1.opm index prune -p etcd --from-index quay.io/olmqe/etcd-index:47322-single
WARN[0000] DEPRECATION NOTICE:
Sqlite-based catalogs and their related subcommands are deprecated. Support for
them will be removed in a future release. Please migrate your catalog workflows
to the new file-based catalog format. 
INFO[0000] pruning the index                             packages="[etcd]"
INFO[0000] Pulling previous image quay.io/olmqe/etcd-index:47322-single to get metadata  packages="[etcd]"
INFO[0000] running /usr/bin/podman pull quay.io/olmqe/etcd-index:47322-single  packages="[etcd]"
INFO[0001] running /usr/bin/podman pull quay.io/olmqe/etcd-index:47322-single  packages="[etcd]"
INFO[0002] Getting label data from previous image        packages="[etcd]"
INFO[0002] running podman inspect                        packages="[etcd]"
Error: index image quay.io/olmqe/etcd-index:47322-single missing label operators.operatorframework.io.index.database.v1
Usage:
  opm index prune [flags]

Flags:
  -i, --binary-image opm        container image for on-image opm command
  -c, --container-tool string   tool to interact with container images (save, build, etc.). One of: [docker, podman] (default "podman")
  -f, --from-index string       index to prune
      --generate                if enabled, just creates the dockerfile and saves it to local disk
  -h, --help                    help for prune
  -d, --out-dockerfile string   if generating the dockerfile, this flag is used to (optionally) specify a dockerfile name
  -p, --packages strings        comma separated list of packages to keep
      --permissive              allow registry load errors
  -t, --tag string              custom tag for container image being built

Global Flags:
      --skip-tls   skip TLS certificate verification for container image registries while pulling bundles or index

2.
3.

Actual results:
the error message is not clear.
"Error: index image quay.io/olmqe/etcd-index:47322-single missing label operators.operatorframework.io.index.database.v1"

Expected results:

the error message should be more clear, for example "opm index prune doesn’t support file-based catalog" or "opm index prune only support sqlite-based catalog"

Additional info:

Comment 1 xzha 2022-05-19 07:15:31 UTC
verify:
zhaoxia@xzha-mac operator-framework-olm % ./bin/opm version
Version: version.Version{OpmVersion:"5bbcf1030", GitCommit:"5bbcf1030d00435022e8300cab1fbada4edf0096", BuildDate:"2022-05-19T07:08:59Z", GoOs:"darwin", GoArch:"amd64"}

zhaoxia@xzha-mac operator-framework-olm % ./bin/opm index prune -p etcd --from-index quay.io/olmqe/etcd-index:47322-single -c docker
WARN[0000] DEPRECATION NOTICE:
Sqlite-based catalogs and their related subcommands are deprecated. Support for
them will be removed in a future release. Please migrate your catalog workflows
to the new file-based catalog format. 
INFO[0000] pruning the index                             packages="[etcd]"
INFO[0000] Pulling previous image quay.io/olmqe/etcd-index:47322-single to get metadata  packages="[etcd]"
INFO[0000] running /usr/local/bin/docker pull quay.io/olmqe/etcd-index:47322-single  packages="[etcd]"
INFO[0004] running /usr/local/bin/docker pull quay.io/olmqe/etcd-index:47322-single  packages="[etcd]"
INFO[0008] Getting label data from previous image        packages="[etcd]"
INFO[0008] running docker inspect                        packages="[etcd]"
Error: `opm index prune` only supports sqlite-based catalogs
Usage:
  opm index prune [flags]

Flags:
  -i, --binary-image opm        container image for on-image opm command
  -c, --container-tool string   tool to interact with container images (save, build, etc.). One of: [docker, podman] (default "podman")
  -f, --from-index string       index to prune
      --generate                if enabled, just creates the dockerfile and saves it to local disk
  -h, --help                    help for prune
  -d, --out-dockerfile string   if generating the dockerfile, this flag is used to (optionally) specify a dockerfile name
  -p, --packages strings        comma separated list of packages to keep
      --permissive              allow registry load errors
  -t, --tag string              custom tag for container image being built

Global Flags:
      --skip-tls-verify   skip TLS certificate verification for container image registries while pulling bundles
      --use-http          use plain HTTP for container image registries while pulling bundles


LGTM, verified

Comment 6 errata-xmlrpc 2022-08-10 10:41:42 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 (Important: OpenShift Container Platform 4.11.0 bug fix and security 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/RHSA-2022:5069


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