Description of problem: It's possible to run `opm index add --bundles <bundle> --from-index <index>` and have it succeed with no errors, but not contain <bundle> at all. This happens when: - the bundle being added "replaces" the current head of a channel - but the current head of the channel has a higher semver version than the bundle being added Rather than walk back channel head heuristics, opm should just throw an error if bundles in the input are not included in the final graph. That should at least make this case detectable so that it can be corrected early in a release cycle.
This situation already causes problems for ISV bundles. One partner has the following situation: Current head of channel: 4.0.5003 Intended replacement: 4.0.6, with "replaces" clause to supercede 4.0.5003. Result: 4.0.6 is "submarined" and is not available to the OLM for upgrading. Intended result by the partner: 4.0.6 would be the head of the channel. Rather than throwing an error, wouldn't it make more sense to ensure that the 'replaces' clause wins out over what semantic versioning would otherwise select as the head?
(In reply to John Francini from comment #2) After discussing this issue with Brian Cook, I withdraw my suggestion in Comment #2.
*** Bug 1982311 has been marked as a duplicate of this bug. ***
verify: zhaoxia@xzha-mac ditto-operator % opm version Version: version.Version{OpmVersion:"edcddea0f", GitCommit:"edcddea0f2b6344bc388b746078d6ae81dfbf1f8", BuildDate:"2021-08-16T06:57:47Z", GoOs:"darwin", GoArch:"amd64"} 1) check index image quay.io/olmqe/ditto-index:1983673-1 zhaoxia@xzha-mac ditto-operator % opm alpha list channels quay.io/olmqe/ditto-index:1983673-1 PACKAGE CHANNEL HEAD ditto-operator alpha ditto-operator.v0.2.0 zhaoxia@xzha-mac ditto-operator % opm alpha list bundles quay.io/olmqe/ditto-index:1983673-1 PACKAGE CHANNEL BUNDLE REPLACES SKIPS SKIP RANGE IMAGE ditto-operator alpha ditto-operator.v0.1.1 quay.io/olmqe/ditto-operator:1983673-0.1.1 ditto-operator alpha ditto-operator.v0.2.0 ditto-operator.v0.1.1 quay.io/olmqe/ditto-operator:1983673-0.2.0 2) add quay.io/olmqe/ditto-operator:1983673-0.1.2 to quay.io/olmqe/ditto-index:1983673-1 zhaoxia@xzha-mac ditto-operator % opm render quay.io/olmqe/ditto-operator:1983673-0.1.2 -o json { "schema": "olm.bundle", "name": "ditto-operator.v0.1.2", "package": "ditto-operator", "image": "quay.io/olmqe/ditto-operator:1983673-0.1.2", "properties": [ { "type": "olm.channel", "value": { "name": "alpha", "replaces": "ditto-operator.v0.2.0" } }, { "type": "olm.gvk", "value": { "group": "iot.eclipse.org", "kind": "Ditto", "version": "v1alpha1" } }, { "type": "olm.package", "value": { "packageName": "ditto-operator", "version": "0.1.2" } } ] } zhaoxia@xzha-mac ditto-operator % opm index add -b quay.io/olmqe/ditto-operator:1983673-0.1.2 -f quay.io/olmqe/ditto-index:1983673-1 -t quay.io/olmqe/ditto-index:1983673-2 -c docker INFO[0000] building the index bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.2]" INFO[0000] Pulling previous image quay.io/olmqe/ditto-index:1983673-1 to get metadata bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.2]" INFO[0000] running /usr/local/bin/docker pull quay.io/olmqe/ditto-index:1983673-1 bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.2]" INFO[0003] running /usr/local/bin/docker pull quay.io/olmqe/ditto-index:1983673-1 bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.2]" INFO[0007] Getting label data from previous image bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.2]" INFO[0007] running docker inspect bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.2]" INFO[0008] running docker create bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.2]" INFO[0008] running docker cp bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.2]" INFO[0009] running docker rm bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.2]" INFO[0010] running /usr/local/bin/docker pull quay.io/olmqe/ditto-operator:1983673-0.1.2 bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.2]" INFO[0015] running docker create bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.2]" INFO[0015] running docker cp bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.2]" INFO[0015] running docker rm bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.2]" INFO[0015] Could not find optional dependencies file file=bundle_tmp453545669/metadata load=annotations with=bundle_tmp453545669 INFO[0015] Could not find optional properties file file=bundle_tmp453545669/metadata load=annotations with=bundle_tmp453545669 INFO[0015] Could not find optional dependencies file file=bundle_tmp453545669/metadata load=annotations with=bundle_tmp453545669 INFO[0015] Could not find optional properties file file=bundle_tmp453545669/metadata load=annotations with=bundle_tmp453545669 ERRO[0015] permissive mode disabled bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.2]" error="added bundle quay.io/olmqe/ditto-operator:1983673-0.1.2 pruned from package ditto-operator, channel alpha: this may be due to incorrect channel head (ditto-operator.v0.2.0)" Error: added bundle quay.io/olmqe/ditto-operator:1983673-0.1.2 pruned from package ditto-operator, channel alpha: this may be due to incorrect channel head (ditto-operator.v0.2.0) 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 zhaoxia@xzha-mac ditto-operator % opm index add -b quay.io/olmqe/ditto-operator:1983673-0.1.1,quay.io/olmqe/ditto-operator:1983673-0.2.0,quay.io/olmqe/ditto-operator:1983673-0.1.2 -t quay.io/olmqe/ditto-index:1983673-1 -c docker INFO[0000] building the index bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.1 quay.io/olmqe/ditto-operator:1983673-0.2.0 quay.io/olmqe/ditto-operator:1983673-0.1.2]" INFO[0000] running /usr/local/bin/docker pull quay.io/olmqe/ditto-operator:1983673-0.1.1 bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.1 quay.io/olmqe/ditto-operator:1983673-0.2.0 quay.io/olmqe/ditto-operator:1983673-0.1.2]" INFO[0007] running docker create bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.1 quay.io/olmqe/ditto-operator:1983673-0.2.0 quay.io/olmqe/ditto-operator:1983673-0.1.2]" INFO[0007] running docker cp bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.1 quay.io/olmqe/ditto-operator:1983673-0.2.0 quay.io/olmqe/ditto-operator:1983673-0.1.2]" INFO[0007] running docker rm bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.1 quay.io/olmqe/ditto-operator:1983673-0.2.0 quay.io/olmqe/ditto-operator:1983673-0.1.2]" INFO[0008] running /usr/local/bin/docker pull quay.io/olmqe/ditto-operator:1983673-0.2.0 bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.1 quay.io/olmqe/ditto-operator:1983673-0.2.0 quay.io/olmqe/ditto-operator:1983673-0.1.2]" INFO[0015] running docker create bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.1 quay.io/olmqe/ditto-operator:1983673-0.2.0 quay.io/olmqe/ditto-operator:1983673-0.1.2]" INFO[0015] running docker cp bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.1 quay.io/olmqe/ditto-operator:1983673-0.2.0 quay.io/olmqe/ditto-operator:1983673-0.1.2]" INFO[0016] running docker rm bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.1 quay.io/olmqe/ditto-operator:1983673-0.2.0 quay.io/olmqe/ditto-operator:1983673-0.1.2]" INFO[0016] running /usr/local/bin/docker pull quay.io/olmqe/ditto-operator:1983673-0.1.2 bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.1 quay.io/olmqe/ditto-operator:1983673-0.2.0 quay.io/olmqe/ditto-operator:1983673-0.1.2]" INFO[0023] running docker create bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.1 quay.io/olmqe/ditto-operator:1983673-0.2.0 quay.io/olmqe/ditto-operator:1983673-0.1.2]" INFO[0023] running docker cp bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.1 quay.io/olmqe/ditto-operator:1983673-0.2.0 quay.io/olmqe/ditto-operator:1983673-0.1.2]" INFO[0024] running docker rm bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.1 quay.io/olmqe/ditto-operator:1983673-0.2.0 quay.io/olmqe/ditto-operator:1983673-0.1.2]" INFO[0024] Could not find optional dependencies file file=bundle_tmp846457054/metadata load=annotations with=bundle_tmp846457054 INFO[0024] Could not find optional properties file file=bundle_tmp846457054/metadata load=annotations with=bundle_tmp846457054 INFO[0024] Could not find optional dependencies file file=bundle_tmp806139340/metadata load=annotations with=bundle_tmp806139340 INFO[0024] Could not find optional properties file file=bundle_tmp806139340/metadata load=annotations with=bundle_tmp806139340 INFO[0024] Could not find optional dependencies file file=bundle_tmp121234107/metadata load=annotations with=bundle_tmp121234107 INFO[0024] Could not find optional properties file file=bundle_tmp121234107/metadata load=annotations with=bundle_tmp121234107 INFO[0024] Could not find optional dependencies file file=bundle_tmp806139340/metadata load=annotations with=bundle_tmp806139340 INFO[0024] Could not find optional properties file file=bundle_tmp806139340/metadata load=annotations with=bundle_tmp806139340 INFO[0024] Could not find optional dependencies file file=bundle_tmp121234107/metadata load=annotations with=bundle_tmp121234107 INFO[0024] Could not find optional properties file file=bundle_tmp121234107/metadata load=annotations with=bundle_tmp121234107 INFO[0024] Could not find optional dependencies file file=bundle_tmp846457054/metadata load=annotations with=bundle_tmp846457054 INFO[0024] Could not find optional properties file file=bundle_tmp846457054/metadata load=annotations with=bundle_tmp846457054 ERRO[0024] permissive mode disabled bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.1 quay.io/olmqe/ditto-operator:1983673-0.2.0 quay.io/olmqe/ditto-operator:1983673-0.1.2]" error="added bundle quay.io/olmqe/ditto-operator:1983673-0.1.2 pruned from package ditto-operator, channel alpha: this may be due to incorrect channel head (ditto-operator.v0.2.0)" Error: added bundle quay.io/olmqe/ditto-operator:1983673-0.1.2 pruned from package ditto-operator, channel alpha: this may be due to incorrect channel head (ditto-operator.v0.2.0) Usage: opm index add [flags] .... LGTM, verified.
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 (Moderate: OpenShift Container Platform 4.9.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-2021:3759