Description of problem: "opm alpha diff" doesn't support olm.constraint Version-Release number of selected component (if applicable): [root@preserve-olm-agent-test 2371]# 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: 1. create index image: quay.io/olmqe/etcd-index:test-cel-xzhao-1 [root@preserve-olm-agent-test filebased]# opm alpha list bundles quay.io/olmqe/etcd-index:test-cel-xzhao-1 PACKAGE CHANNEL BUNDLE REPLACES SKIPS SKIP RANGE IMAGE ditto-operator alpha ditto-operator.v0.1.0 quay.io/olmqe/ditto-bundle:v0.1.0-zhao ditto-operator alpha ditto-operator.v0.1.1 ditto-operator.v0.1.0 quay.io/olmqe/ditto-bundle:v0.1.1-zhao ditto-operator alpha ditto-operator.v0.2.0 ditto-operator.v0.1.1 quay.io/olmqe/ditto-bundle:v0.2.0-zhao etcd alpha etcdoperator.v0.9.2 quay.io/olmqe/etcd-bundle:v0.9.2-zhao etcd beta etcdoperator.v0.9.2 quay.io/olmqe/etcd-bundle:v0.9.2-zhao etcd beta etcdoperator.v0.9.4 etcdoperator.v0.9.2 quay.io/olmqe/etcd-bundle:v0.9.4-zhao [root@preserve-olm-agent-test filebased]# opm render quay.io/olmqe/etcd-index:test-cel-xzhao-1 -o yaml | grep olm.constraint -A 8 -B 3 name: etcdoperator.v0.9.2 package: etcd properties: - type: olm.constraint value: Message: require to have ditto-operator.v0.1.1 cel: rule: 'properties.exists(p, p.type == "olm.gvk" && p.value == {"group": "iot.eclipse.org", "version": "v1alpha1", "kind": "Ditto"}) && properties.exists(p, p.type == "olm.package" && p.value.packageName == "ditto-operator" && (semver_compare(p.value.version, "0.1.1") == 0))' - type: olm.gvk -- name: etcdoperator.v0.9.4 package: etcd properties: - type: olm.constraint value: Message: require to have ditto-operator.v0.2.0 cel: rule: 'properties.exists(p, p.type == "olm.gvk" && p.value == {"group": "iot.eclipse.org", "version": "v1alpha1", "kind": "Ditto"}) && properties.exists(p, p.type == "olm.package" && p.value.packageName == "ditto-operator" && (semver_compare(p.value.version, "0.2.0") == 0))' - type: olm.gvk 2. run opm alpha diff [root@preserve-olm-agent-test filebased]# opm alpha diff quay.io/olmqe/etcd-index:test-cel-xzhao-1 -o json | jq '{name, schema}|select(.schema=="olm.bundle")'| jq '{name}' { "name": "ditto-operator.v0.2.0" } { "name": "etcdoperator.v0.9.2" } { "name": "etcdoperator.v0.9.4" } Actual results: The output of "opm alpha diff" doesn't contain the dependency ditto-operator.v0.1.1 for etcdoperator.v0.9.2 Expected results: The output of "opm alpha diff" does contain the dependency ditto-operator.v0.1.1 for etcdoperator.v0.9.2 Additional info: The error is also happened when using Sqlite-based catalog quay.io/olmqe/etcd-index:test-cel-xzhao.
I also met this issue using bellow olm.constraint format [root@preserve-olm-agent-test filebased-compound-bundle-constraints]# opm render quay.io/olmqe/etcd-index:test-xzhao-compound-bundle-constraints -o yaml | grep olm.constraint -A 13 -B 3 name: etcdoperator.v0.9.2 package: etcd properties: - type: olm.constraint value: all: constraints: - message: Package ditto is needed for... package: packageName: ditto-operator versionRange: 0.1.1 - gvk: group: iot.eclipse.org kind: Ditto version: v1alpha1 message: GVK iot/v1apha1 is needed for... message: All are required for Baz because... -- name: etcdoperator.v0.9.4 package: etcd properties: - type: olm.constraint value: all: constraints: - message: Package ditto is needed for... package: packageName: ditto-operator versionRange: 0.2.0 - gvk: group: iot.eclipse.org kind: Ditto version: v1alpha1 message: GVK iot/v1apha1 is needed for... message: All are required for Baz because... [root@preserve-olm-agent-test filebased-compound-bundle-constraints]# opm alpha diff quay.io/olmqe/etcd-index:test-xzhao-compound-bundle-constraints -o json | jq '{name, schema}|select(.schema=="olm.bundle")'| jq '{name}' { "name": "ditto-operator.v0.2.0" } { "name": "etcdoperator.v0.9.2" } { "name": "etcdoperator.v0.9.4" }
Moving back to NEW until this is prioritized.
Hi Vu, Can you please attach the PR that fixes this bug? current master version of operator-framework-olm does not contain the fix: * 5863540f4 - (HEAD -> master, origin/release-4.11, origin/release-4.10, origin/master, origin/HEAD) Merge pull request #248 from tylerslaton/sync-constraint-changes (5 days ago) <OpenShift Merge Robot> ./bin/opm version Version: version.Version{OpmVersion:"5863540f4", GitCommit:"5863540f44addf07e564b2e7c833c8a5f85841e7", BuildDate:"2022-02-02T14:13:58Z", GoOs:"linux", GoArch:"386"} ./bin/opm render quay.io/olmqe/etcd-index:test-cel-xzhao-1 -o yaml | grep olm.constraint -A 8 - type: olm.constraint value: Message: require to have ditto-operator.v0.1.1 cel: rule: 'properties.exists(p, p.type == "olm.gvk" && p.value == {"group": "iot.eclipse.org", "version": "v1alpha1", "kind": "Ditto"}) && properties.exists(p, p.type == "olm.package" && p.value.packageName == "ditto-operator" && (semver_compare(p.value.version, "0.1.1") == 0))' - type: olm.gvk -- - type: olm.constraint value: Message: require to have ditto-operator.v0.2.0 cel: rule: 'properties.exists(p, p.type == "olm.gvk" && p.value == {"group": "iot.eclipse.org", "version": "v1alpha1", "kind": "Ditto"}) && properties.exists(p, p.type == "olm.package" && p.value.packageName == "ditto-operator" && (semver_compare(p.value.version, "0.2.0") == 0))' - type: olm.gvk ./bin/opm alpha diff quay.io/olmqe/etcd-index:test-cel-xzhao-1 -o json | jq '{name, schema}|select(.schema=="olm.bundle")'| jq '{name}' WARN[0002] {"created":"2021-12-29T04:41:52.260870497Z","author":"Bazel","architecture":"amd64","os":"linux","config":{"User":"0","Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/busybox","SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt"],"Entrypoint":["/bin/opm"],"Cmd":["serve","/configs"],"WorkingDir":"/","Labels":{"io.buildah.version":"1.19.8","operators.operatorframework.io.index.configs.v1":"/configs"}},"rootfs":{"type":"layers","diff_ids":["sha256:6d75f23be3ddcb784b51ea7ef9b6a3a038f9e0b2f08f08628b226dba8b5161f8","sha256:5d6a8d4078ceeab04d54c271dea21131637c2c8e60c14ff55e8d62ca9e018075","sha256:dd4ed6fbb3ba0b6a826a83714010532e3d739583ff677c698f46e776946d39a8","sha256:ba3365d1784de421eed4f7bd5ceec130f4fa50f29d4a1c2e4691788c7bb99085","sha256:c71a09fbf6a2f1cf89e36493e3acd76286efd65e8e6dc3eec4161cd04a02f927","sha256:5b46b6fe50d7ea720d6259a2395ba50b7bebbeca5896439a4f5c836e7b14bb4e"]},"history":[{"created":"1970-01-01T00:00:00Z","created_by":"bazel build ...","author":"Bazel"},{"created":"1970-01-01T00:00:00Z","created_by":"bazel build ...","author":"Bazel"},{"created":"2021-11-24T15:06:48.302124478Z","created_by":"COPY /grpc_health_probe /bin/grpc_health_probe # buildkit","comment":"buildkit.dockerfile.v0"},{"created":"2021-11-24T15:06:48.323120135Z","created_by":"COPY nsswitch.conf /etc/nsswitch.conf # buildkit","comment":"buildkit.dockerfile.v0"},{"created":"2021-11-24T15:06:48.541460913Z","created_by":"COPY opm /bin/opm # buildkit","comment":"buildkit.dockerfile.v0"},{"created":"2021-11-24T15:06:48.541460913Z","created_by":"ENTRYPOINT [\"/bin/opm\"]","comment":"buildkit.dockerfile.v0","empty_layer":true},{"created":"2021-12-29T02:00:51.732800607Z","created_by":"/bin/sh -c #(nop) ENTRYPOINT [\"/bin/opm\"]","author":"Bazel","empty_layer":true},{"created":"2021-12-29T02:00:51.853781648Z","created_by":"/bin/sh -c #(nop) CMD [\"serve\", \"/configs\"]","author":"Bazel","empty_layer":true},{"created":"2021-12-29T04:41:52.000263702Z","created_by":"/bin/sh -c #(nop) ADD dir:3f37d5d8dbce171c078db5fb515b8eb47c570f23ea5e4a47808a0abefa901d04 in /configs ","author":"Bazel"},{"created":"2021-12-29T04:41:52.261203819Z","created_by":"/bin/sh -c #(nop) LABEL operators.operatorframework.io.index.configs.v1=/configs","author":"Bazel","empty_layer":true}]} { "name": "ditto-operator.v0.2.0" } { "name": "etcdoperator.v0.9.2" } { "name": "etcdoperator.v0.9.4" } Package ditto-operator.v0.1.1 is not shown as a dependency. Moving back to ASSIGNED
verify: zhaoxia@xzha-mac bin % opm version Version: version.Version{OpmVersion:"d5f87aa5d", GitCommit:"d5f87aa5d2c4398cf40c030430998677b6fd054c", BuildDate:"2022-03-28T01:21:18Z", GoOs:"darwin", GoArch:"amd64"} zhaoxia@xzha-mac bin % opm alpha list bundles quay.io/olmqe/etcd-index:test-cel-xzhao-1 PACKAGE CHANNEL BUNDLE REPLACES SKIPS SKIP RANGE IMAGE ditto-operator alpha ditto-operator.v0.1.0 quay.io/olmqe/ditto-bundle:v0.1.0-zhao ditto-operator alpha ditto-operator.v0.1.1 ditto-operator.v0.1.0 quay.io/olmqe/ditto-bundle:v0.1.1-zhao ditto-operator alpha ditto-operator.v0.2.0 ditto-operator.v0.1.1 quay.io/olmqe/ditto-bundle:v0.2.0-zhao etcd alpha etcdoperator.v0.9.2 quay.io/olmqe/etcd-bundle:v0.9.2-zhao etcd beta etcdoperator.v0.9.2 quay.io/olmqe/etcd-bundle:v0.9.2-zhao etcd beta etcdoperator.v0.9.4 etcdoperator.v0.9.2 quay.io/olmqe/etcd-bundle:v0.9.4-zhao zhaoxia@xzha-mac bin % opm render quay.io/olmqe/etcd-index:test-cel-xzhao-1 -o yaml | grep olm.constraint -A 8 - type: olm.constraint value: Message: require to have ditto-operator.v0.1.1 cel: rule: 'properties.exists(p, p.type == "olm.gvk" && p.value == {"group": "iot.eclipse.org", "version": "v1alpha1", "kind": "Ditto"}) && properties.exists(p, p.type == "olm.package" && p.value.packageName == "ditto-operator" && (semver_compare(p.value.version, "0.1.1") == 0))' - type: olm.gvk -- - type: olm.constraint value: Message: require to have ditto-operator.v0.2.0 cel: rule: 'properties.exists(p, p.type == "olm.gvk" && p.value == {"group": "iot.eclipse.org", "version": "v1alpha1", "kind": "Ditto"}) && properties.exists(p, p.type == "olm.package" && p.value.packageName == "ditto-operator" && (semver_compare(p.value.version, "0.2.0") == 0))' - type: olm.gvk zhaoxia@xzha-mac bin % opm alpha diff quay.io/olmqe/etcd-index:test-cel-xzhao-1 -o json | jq '{name, schema}|select(.schema=="olm.bundle")'| jq '{name}' { "name": "ditto-operator.v0.2.0" } { "name": "etcdoperator.v0.9.2" } { "name": "etcdoperator.v0.9.4" } The output of "opm alpha diff" doesn't contain the dependency ditto-operator.v0.1.1 for etcdoperator.v0.9.2 PR https://github.com/operator-framework/operator-registry/pull/901 only make "opm render" support olm.constraint, "opm alpha diff" still not support olm.constraint. Failed.
Hi all, I thought I have commented on this BZ or perhaps I forgot or mistook it for another BZ. Just to be clear here: the current `opm diff` is NOT capable of resolving `olm.constraint` dependency unlike the `olm.gvk` or `olm.package` dependency. It is a known limitation of `opm diff` given `opm` command doesn't actually use resolver API (which is currently not available for use anyway). The merged PR was to only fix the issue with `olm.constraint` property is missing in the output of `opm diff`. Effectively, this BZ is a RFE. Thanks, Vu
Thanks Vu - it looks like I mischaracterized this BZ when I was looking at yesterday. Given Vu's previous comments, and the overall fact that the diff sub-command is still an alpha-level command, I'm going to close this out as WONTFIX.