Bug 1882479 - opm index add produces empty index when replacement isn't in the index
Summary: opm index add produces empty index when replacement isn't in the index
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: OLM
Version: 4.6
Hardware: Unspecified
OS: Unspecified
unspecified
urgent
Target Milestone: ---
: 4.6.0
Assignee: lgallett
QA Contact: kuiwang
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-09-24 16:42 UTC by lgallett
Modified: 2020-10-27 16:45 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-10-27 16:45:08 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github operator-framework operator-registry pull 455 0 None closed Bug 1882479: erroring when replacement not found 2020-11-26 02:01:41 UTC
Red Hat Product Errata RHBA-2020:4196 0 None None None 2020-10-27 16:45:22 UTC

Description lgallett 2020-09-24 16:42:47 UTC
Description of problem:

opm index add errors silently when replacement isn't in the index

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

0.14.0

How reproducible:

always

Steps to Reproduce:
1. create a bundle that replaces another
2. add that bundle to an empty index

here is a command / bundles to help validate:

opm index add -b="quay.io/galletti94/opendatahub-test:0.8.0,quay.io/galletti94/opendatahub-test:0.5.2" -t "quay.io/galletti94/my-index:1.0" -u=docker

Actual results:

resulting db is empty

Expected results:

error should be raised

Comment 2 kuiwang 2020-09-25 05:51:02 UTC
verify it. LGTM

--
[root@preserve-olm-env operator-registry]# git log -n 1
commit e2068e0b1e14491b6b0497a23f9b7ba843096fd2
Merge: 83d95a8 4d61b1a
Author: OpenShift Merge Robot <openshift-merge-robot.github.com>
Date:   Fri Sep 25 00:08:58 2020 +0000

    Merge pull request #451 from dinhxuanvu/default-chan
    
    Bug 1878213: Update index add func to handle optional default channel

[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=e2068e0' -X 'github.com/operator-framework/operator-registry/cmd/opm/version.opmVersion=v1.13.8-34-ge2068e0' -X 'github.com/operator-framework/operator-registry/cmd/opm/version.buildDate=2020-09-25T05:37:48Z'"  -tags "json1" -o bin/opm ./cmd/opm

[root@preserve-olm-env operator-registry]# bin/opm version
Version: version.Version{OpmVersion:"v1.13.8-34-ge2068e0", GitCommit:"e2068e0", BuildDate:"2020-09-25T05:37:48Z", GoOs:"linux", GoArch:"amd64"}

[root@preserve-olm-env operator-registry]# bin/opm index add -b="quay.io/galletti94/opendatahub-test:0.8.0,quay.io/galletti94/opendatahub-test:0.5.2" -t "quay.io/galletti94/my-index:1.0" -u=docker
INFO[0000] building the index                            bundles="[quay.io/galletti94/opendatahub-test:0.8.0 quay.io/galletti94/opendatahub-test:0.5.2]"
INFO[0000] resolved name: quay.io/galletti94/opendatahub-test:0.8.0 
INFO[0000] fetched                                       digest="sha256:347ac619ae711146cb2fc6e312561737f5922182961ef12aaef82c1ece572dfc"
INFO[0000] fetched                                       digest="sha256:2133d0bdbe0558eb39b442520d2204ac9c368e361da8df52681cbf85da24f2e8"
INFO[0000] fetched                                       digest="sha256:5a7ed188856b6692c58359a98a7f5a9ba68b124bfb009e8ea4e8ac50f8b66d5e"
INFO[0000] fetched                                       digest="sha256:eed96d350c7cf55a62db1bd343e1970426b8c04d8863ce88b7973e6806f1f823"
INFO[0000] unpacking layer: {application/vnd.docker.image.rootfs.diff.tar.gzip sha256:eed96d350c7cf55a62db1bd343e1970426b8c04d8863ce88b7973e6806f1f823 22361 [] map[] <nil>} 
INFO[0000] unpacking layer: {application/vnd.docker.image.rootfs.diff.tar.gzip sha256:5a7ed188856b6692c58359a98a7f5a9ba68b124bfb009e8ea4e8ac50f8b66d5e 290 [] map[] <nil>} 
INFO[0000] resolved name: quay.io/galletti94/opendatahub-test:0.5.2 
INFO[0000] fetched                                       digest="sha256:ec9dc65b37cb71af3b6817e83086a600c464c785999ae8d5b452bc21b4ddd5c7"
INFO[0000] fetched                                       digest="sha256:24ef447fd2596209b0d5435870af210bc1bfb28a6a7bc2a81f9363aaed61bd0a"
INFO[0000] fetched                                       digest="sha256:8c66cd03f9ceab9ad4c26f41fa918c9e23475afe20ff28f006386e1cc97366d6"
INFO[0000] fetched                                       digest="sha256:bcb4a09c5b79c40704dfc46aeadb1f687584b65dca17eb1351d28ca8b0bb9832"
INFO[0000] unpacking layer: {application/vnd.docker.image.rootfs.diff.tar.gzip sha256:bcb4a09c5b79c40704dfc46aeadb1f687584b65dca17eb1351d28ca8b0bb9832 24317 [] map[] <nil>} 
INFO[0000] unpacking layer: {application/vnd.docker.image.rootfs.diff.tar.gzip sha256:24ef447fd2596209b0d5435870af210bc1bfb28a6a7bc2a81f9363aaed61bd0a 296 [] map[] <nil>} 
INFO[0000] Could not find optional dependencies file     dir=bundle_tmp176128098 file=bundle_tmp176128098/metadata load=annotations
INFO[0000] found csv, loading bundle                     dir=bundle_tmp176128098 file=bundle_tmp176128098/manifests load=bundle
INFO[0000] loading bundle file                           dir=bundle_tmp176128098/manifests file=kfdef.apps.kubeflow.org.crd.yaml load=bundle
INFO[0000] loading bundle file                           dir=bundle_tmp176128098/manifests file=opendatahub-operator.v0.8.0.clusterserviceversion.yaml load=bundle
INFO[0000] Could not find optional dependencies file     dir=bundle_tmp298070617 file=bundle_tmp298070617/metadata load=annotations
INFO[0000] found csv, loading bundle                     dir=bundle_tmp298070617 file=bundle_tmp298070617/manifests load=bundle
INFO[0000] loading bundle file                           dir=bundle_tmp298070617/manifests file=opendatahub-operator.v0.5.2.clusterserviceversion.yaml load=bundle
INFO[0000] loading bundle file                           dir=bundle_tmp298070617/manifests file=opendatahub_v1alpha1_opendatahub_crd.yaml load=bundle
ERRO[0000] permissive mode disabled                      bundles="[quay.io/galletti94/opendatahub-test:0.8.0 quay.io/galletti94/opendatahub-test:0.5.2]" error="[Invalid bundle opendatahub-operator.v0.8.0, bundle specifies a non-existent replacement opendatahub-operator.v0.7.0, Invalid bundle opendatahub-operator.v0.5.2, bundle specifies a non-existent replacement opendatahub-operator.v0.5.1]"
Error: [Invalid bundle opendatahub-operator.v0.8.0, bundle specifies a non-existent replacement opendatahub-operator.v0.7.0, Invalid bundle opendatahub-operator.v0.5.2, bundle specifies a non-existent replacement opendatahub-operator.v0.5.1]
Usage:
  opm index add [flags]

Examples:
  # Create an index image from scratch with a single bundle image
  opm index add --bundles quay.io/operator-framework/operator-bundle-prometheus@sha256:a3ee653ffa8a0d2bbb2fabb150a94da6e878b6e9eb07defd40dc884effde11a0 --tag quay.io/operator-framework/monitoring:1.0.0
  
  # Add a single bundle image to an index image
  opm index add --bundles quay.io/operator-framework/operator-bundle-prometheus:0.15.0 --from-index quay.io/operator-framework/monitoring:1.0.0 --tag quay.io/operator-framework/monitoring:1.0.1
  
  # Add multiple bundles to an index and generate a Dockerfile instead of an image
  opm index add --bundles quay.io/operator-framework/operator-bundle-prometheus:0.15.0,quay.io/operator-framework/operator-bundle-prometheus:0.22.2 --generate

Flags:
  -i, --binary-image opm        container image for on-image opm command
  -u, --build-tool string       tool to build container images. One of: [docker, podman]. Defaults to podman. Overrides part of container-tool.
  -b, --bundles strings         comma separated list of bundles to add
  -c, --container-tool string   tool to interact with container images (save, build, etc.). One of: [docker, podman]
  -f, --from-index string       previous index to add to
      --generate                if enabled, just creates the dockerfile and saves it to local disk
  -h, --help                    help for add
      --mode string             graph update mode that defines how channel graphs are updated. One of: [replaces, semver, semver-skippatch] (default "replaces")
  -d, --out-dockerfile string   if generating the dockerfile, this flag is used to (optionally) specify a dockerfile name
      --permissive              allow registry load errors
  -p, --pull-tool string        tool to pull container images. One of: [none, docker, podman]. Defaults to none. Overrides part of container-tool.
  -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


--

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


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