Skip to content

Commit 6c9ca25

Browse files
committed
fix: do not include channel name or priority in bundle sorting during resolution
Signed-off-by: Joe Lanford <[email protected]>
1 parent 4b9cfd9 commit 6c9ca25

19 files changed

+112
-198
lines changed

internal/controllers/operator_controller_test.go

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,7 @@ var _ = Describe("Operator Controller Test", func() {
820820
BeforeEach(func() {
821821
By("initializing cluster state")
822822
pkgName = "prometheus"
823-
pkgChan = "alpha"
823+
pkgChan = "non-existent"
824824
operator = &operatorsv1alpha1.Operator{
825825
ObjectMeta: metav1.ObjectMeta{Name: opKey.Name},
826826
Spec: operatorsv1alpha1.OperatorSpec{
@@ -1081,17 +1081,24 @@ func verifyConditionsInvariants(op *operatorsv1alpha1.Operator) {
10811081
}
10821082

10831083
var testEntitySource = input.NewCacheQuerier(map[deppy.Identifier]input.Entity{
1084-
"operatorhub/prometheus/0.37.0": *input.NewEntity("operatorhub/prometheus/0.37.0", map[string]string{
1084+
"operatorhub/prometheus/alpha/0.37.0": *input.NewEntity("operatorhub/prometheus/alpha/0.37.0", map[string]string{
1085+
"olm.bundle.path": `"quay.io/operatorhubio/prometheus@sha256:3e281e587de3d03011440685fc4fb782672beab044c1ebadc42788ce05a21c35"`,
1086+
"olm.bundle.channelEntry": `{"name":"prometheus.0.37.0"}`,
1087+
"olm.channel": `{"channelName":"alpha"}`,
1088+
"olm.package": `{"packageName":"prometheus","version":"0.37.0"}`,
1089+
"olm.gvk": `[]`,
1090+
}),
1091+
"operatorhub/prometheus/beta/0.37.0": *input.NewEntity("operatorhub/prometheus/beta/0.37.0", map[string]string{
10851092
"olm.bundle.path": `"quay.io/operatorhubio/prometheus@sha256:3e281e587de3d03011440685fc4fb782672beab044c1ebadc42788ce05a21c35"`,
10861093
"olm.bundle.channelEntry": `{"name":"prometheus.0.37.0"}`,
1087-
"olm.channel": `{"channelName":"beta","priority":0}`,
1094+
"olm.channel": `{"channelName":"beta"}`,
10881095
"olm.package": `{"packageName":"prometheus","version":"0.37.0"}`,
10891096
"olm.gvk": `[]`,
10901097
}),
1091-
"operatorhub/prometheus/0.47.0": *input.NewEntity("operatorhub/prometheus/0.47.0", map[string]string{
1098+
"operatorhub/prometheus/beta/0.47.0": *input.NewEntity("operatorhub/prometheus/beta/0.47.0", map[string]string{
10921099
"olm.bundle.path": `"quay.io/operatorhubio/prometheus@sha256:5b04c49d8d3eff6a338b56ec90bdf491d501fe301c9cdfb740e5bff6769a21ed"`,
10931100
"olm.bundle.channelEntry": `{"name":"prometheus.0.47.0"}`,
1094-
"olm.channel": `{"channelName":"beta","priority":0,"replaces":"prometheusoperator.0.37.0"}`,
1101+
"olm.channel": `{"channelName":"beta","replaces":"prometheusoperator.0.37.0"}`,
10951102
"olm.package": `{"packageName":"prometheus","version":"0.47.0"}`,
10961103
"olm.gvk": `[]`,
10971104
}),
@@ -1104,15 +1111,15 @@ var testEntitySource = input.NewCacheQuerier(map[deppy.Identifier]input.Entity{
11041111
"operatorhub/plain/0.1.0": *input.NewEntity("operatorhub/plain/0.1.0", map[string]string{
11051112
"olm.bundle.path": `"quay.io/operatorhub/plain@sha256:plain"`,
11061113
"olm.bundle.channelEntry": `{"name":"plain.0.1.0"}`,
1107-
"olm.channel": `{"channelName":"beta","priority":0}`,
1114+
"olm.channel": `{"channelName":"beta"}`,
11081115
"olm.package": `{"packageName":"plain","version":"0.1.0"}`,
11091116
"olm.gvk": `[]`,
11101117
"olm.bundle.mediatype": `"plain+v0"`,
11111118
}),
11121119
"operatorhub/badmedia/0.1.0": *input.NewEntity("operatorhub/badmedia/0.1.0", map[string]string{
11131120
"olm.bundle.path": `"quay.io/operatorhub/badmedia@sha256:badmedia"`,
11141121
"olm.bundle.channelEntry": `{"name":"badmedia.0.1.0"}`,
1115-
"olm.channel": `{"channelName":"beta","priority":0}`,
1122+
"olm.channel": `{"channelName":"beta"}`,
11161123
"olm.package": `{"packageName":"badmedia","version":"0.1.0"}`,
11171124
"olm.gvk": `[]`,
11181125
"olm.bundle.mediatype": `"badmedia+v1"`,

internal/resolution/entities/bundle_entity_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ var _ = Describe("BundleEntity", func() {
192192
Describe("ChannelName", func() {
193193
It("should return the bundle channel name if present", func() {
194194
entity := input.NewEntity("operatorhub/prometheus/0.14.0", map[string]string{
195-
"olm.channel": "{\"channelName\":\"beta\",\"priority\":0}",
195+
"olm.channel": "{\"channelName\":\"beta\"}",
196196
})
197197
bundleEntity := olmentity.NewBundleEntity(entity)
198198
channelName, err := bundleEntity.ChannelName()
@@ -220,7 +220,7 @@ var _ = Describe("BundleEntity", func() {
220220
Describe("Channel", func() {
221221
It("should return the bundle channel properties if present", func() {
222222
entity := input.NewEntity("operatorhub/prometheus/0.14.0", map[string]string{
223-
"olm.channel": `{"channelName":"beta","priority":0, "replaces": "bundle.v1.0.0", "skips": ["bundle.v0.9.0", "bundle.v0.9.6"], "skipRange": ">=0.9.0 <=0.9.6"}`,
223+
"olm.channel": `{"channelName":"beta", "replaces": "bundle.v1.0.0", "skips": ["bundle.v0.9.0", "bundle.v0.9.6"], "skipRange": ">=0.9.0 <=0.9.6"}`,
224224
})
225225
bundleEntity := olmentity.NewBundleEntity(entity)
226226
channelProperties, err := bundleEntity.Channel()

internal/resolution/util/predicates/predicates_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,10 @@ func TestPredicatesInBlangSemverRange(t *testing.T) {
106106

107107
func TestPredicatesInChannel(t *testing.T) {
108108
testData := []testData{
109-
{map[string]string{property.TypeChannel: `{"channelName":"stable","priority":0}`},
109+
{map[string]string{property.TypeChannel: `{"channelName":"stable"}`},
110110
"stable",
111111
true},
112-
{map[string]string{property.TypeChannel: `{"channelName":"stable","priority":0}`},
112+
{map[string]string{property.TypeChannel: `{"channelName":"stable"}`},
113113
"unstable",
114114
false},
115115
{map[string]string{},

internal/resolution/util/sort/sort.go

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ import (
88
"github.com/operator-framework/operator-controller/internal/resolution/entities"
99
)
1010

11-
// ByChannelAndVersion is an entity sort function that orders the entities in
12-
// package, channel (default channel at the head), and inverse version (higher versions on top)
13-
// if a property does not exist for one of the entities, the one missing the property is pushed down
14-
// if both entities are missing the same property they are ordered by id
15-
func ByChannelAndVersion(entity1 *input.Entity, entity2 *input.Entity) bool {
11+
// ByPackageAndVersion is an entity sort function that orders the entities in
12+
// package and inverse version (higher versions on top) order.
13+
// If a property does not exist for one of the entities, the one missing the property is pushed down.
14+
// If both entities are missing the same property they are ordered by id
15+
func ByPackageAndVersion(entity1 *input.Entity, entity2 *input.Entity) bool {
1616
e1 := entities.NewBundleEntity(entity1)
1717
e2 := entities.NewBundleEntity(entity2)
1818

@@ -22,12 +22,6 @@ func ByChannelAndVersion(entity1 *input.Entity, entity2 *input.Entity) bool {
2222
return pkgOrder < 0
2323
}
2424

25-
// todo(perdasilva): handle default channel in ordering once it is being exposed by the entity
26-
channelOrder := channelOrder(e1, e2)
27-
if channelOrder != 0 {
28-
return channelOrder < 0
29-
}
30-
3125
// order version from highest to lowest (favor the latest release)
3226
versionOrder := versionOrder(e1, e2)
3327
return versionOrder > 0
@@ -54,19 +48,6 @@ func packageOrder(e1, e2 *entities.BundleEntity) int {
5448
return strings.Compare(name1, name2)
5549
}
5650

57-
func channelOrder(e1, e2 *entities.BundleEntity) int {
58-
channelProperties1, err1 := e1.Channel()
59-
channelProperties2, err2 := e2.Channel()
60-
errComp := compareErrors(err1, err2)
61-
if errComp != 0 {
62-
return errComp
63-
}
64-
if channelProperties1.Priority != channelProperties2.Priority {
65-
return channelProperties1.Priority - channelProperties2.Priority
66-
}
67-
return strings.Compare(channelProperties1.ChannelName, channelProperties2.ChannelName)
68-
}
69-
7051
func versionOrder(e1, e2 *entities.BundleEntity) int {
7152
ver1, err1 := e1.Version()
7253
ver2, err2 := e2.Version()

internal/resolution/util/sort/sort_test.go

Lines changed: 3 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -24,37 +24,7 @@ func TestSortByPackageName(t *testing.T) {
2424
entities := []*input.Entity{e2, e3, e1}
2525

2626
sort.Slice(entities, func(i, j int) bool {
27-
return entitysort.ByChannelAndVersion(entities[i], entities[j])
28-
})
29-
30-
if diff := cmp.Diff(entities[0], e1); diff != "" {
31-
t.Error(diff)
32-
}
33-
if diff := cmp.Diff(entities[1], e2); diff != "" {
34-
t.Error(diff)
35-
}
36-
if diff := cmp.Diff(entities[2], e3); diff != "" {
37-
t.Error(diff)
38-
}
39-
}
40-
41-
func TestSortByChannelName(t *testing.T) {
42-
e1 := input.NewEntity("test1", map[string]string{
43-
property.TypePackage: `{"packageName": "package", "version": "1.0.0"}`,
44-
property.TypeChannel: `{"channelName":"stableA","priority":0}`,
45-
})
46-
e2 := input.NewEntity("test2", map[string]string{
47-
property.TypePackage: `{"packageName": "package", "version": "1.0.0"}`,
48-
property.TypeChannel: `{"channelName":"stableB","priority":0}`,
49-
})
50-
e3 := input.NewEntity("test3", map[string]string{
51-
property.TypePackage: `{"packageName": "package", "version": "1.0.0"}`,
52-
property.TypeChannel: `{"channelName":"stableC","priority":0}`,
53-
})
54-
entities := []*input.Entity{e2, e3, e1}
55-
56-
sort.Slice(entities, func(i, j int) bool {
57-
return entitysort.ByChannelAndVersion(entities[i], entities[j])
27+
return entitysort.ByPackageAndVersion(entities[i], entities[j])
5828
})
5929

6030
if diff := cmp.Diff(entities[0], e1); diff != "" {
@@ -71,20 +41,17 @@ func TestSortByChannelName(t *testing.T) {
7141
func TestSortByVersionNumber(t *testing.T) {
7242
e1 := input.NewEntity("test1", map[string]string{
7343
property.TypePackage: `{"packageName": "mypackage", "version": "1.0.0"}`,
74-
property.TypeChannel: `{"channelName":"stable","priority":0}`,
7544
})
7645
e2 := input.NewEntity("test2", map[string]string{
7746
property.TypePackage: `{"packageName": "mypackage", "version": "2.0.0"}`,
78-
property.TypeChannel: `{"channelName":"stable","priority":0}`,
7947
})
8048
e3 := input.NewEntity("test3", map[string]string{
8149
property.TypePackage: `{"packageName": "mypackage", "version": "3.0.0"}`,
82-
property.TypeChannel: `{"channelName":"stable","priority":0}`,
8350
})
8451
entities := []*input.Entity{e2, e3, e1}
8552

8653
sort.Slice(entities, func(i, j int) bool {
87-
return entitysort.ByChannelAndVersion(entities[i], entities[j])
54+
return entitysort.ByPackageAndVersion(entities[i], entities[j])
8855
})
8956

9057
if diff := cmp.Diff(entities[0], e3); diff != "" {
@@ -98,65 +65,24 @@ func TestSortByVersionNumber(t *testing.T) {
9865
}
9966
}
10067

101-
func TestSortByVersionNumberAndChannelPriority(t *testing.T) {
102-
e1 := input.NewEntity("test1", map[string]string{
103-
property.TypePackage: `{"packageName": "mypackage", "version": "1.0.0"}`,
104-
property.TypeChannel: `{"channelName":"beta","priority":1}`,
105-
})
106-
e2 := input.NewEntity("test2", map[string]string{
107-
property.TypePackage: `{"packageName": "mypackage", "version": "1.0.0"}`,
108-
property.TypeChannel: `{"channelName":"stable","priority":0}`,
109-
})
110-
e3 := input.NewEntity("test3", map[string]string{
111-
property.TypePackage: `{"packageName": "mypackage", "version": "2.0.0"}`,
112-
property.TypeChannel: `{"channelName":"beta","priority":1}`,
113-
})
114-
e4 := input.NewEntity("test4", map[string]string{
115-
property.TypePackage: `{"packageName": "mypackage", "version": "3.0.0"}`,
116-
property.TypeChannel: `{"channelName":"beta","priority":1}`,
117-
})
118-
entities := []*input.Entity{e2, e3, e1, e4}
119-
120-
sort.Slice(entities, func(i, j int) bool {
121-
return entitysort.ByChannelAndVersion(entities[i], entities[j])
122-
})
123-
124-
if diff := cmp.Diff(entities[0], e2); diff != "" {
125-
t.Error(diff)
126-
}
127-
if diff := cmp.Diff(entities[1], e4); diff != "" {
128-
t.Error(diff)
129-
}
130-
if diff := cmp.Diff(entities[2], e3); diff != "" {
131-
t.Error(diff)
132-
}
133-
if diff := cmp.Diff(entities[3], e1); diff != "" {
134-
t.Error(diff)
135-
}
136-
}
137-
13868
func TestSortMissingProperty(t *testing.T) {
13969
e1 := input.NewEntity("test1", map[string]string{
14070
property.TypePackage: `{"packageName": "mypackageA", "version": "1.0.0"}`,
141-
property.TypeChannel: `{"channelName":"stable","priority":0}`,
14271
})
14372
e2 := input.NewEntity("test2", map[string]string{
14473
property.TypePackage: `{"packageName": "mypackageA"}`,
145-
property.TypeChannel: `{"channelName":"stable","priority":0}`,
14674
})
14775
e3 := input.NewEntity("test3", map[string]string{
14876
property.TypePackage: `{"packageName": "mypackageA", "version": "3.0.0"}`,
149-
property.TypeChannel: `{"channelName":"stable","priority":0}`,
15077
})
15178
e4 := input.NewEntity("test4", map[string]string{
15279
property.TypePackage: `{"packageName": "mypackageB", "version": "3.0.0"}`,
153-
property.TypeChannel: `{"channelName":"stable","priority":0}`,
15480
})
15581
e5 := input.NewEntity("test5", map[string]string{})
15682
entities := []*input.Entity{e2, e3, e1, e4, e5}
15783

15884
sort.Slice(entities, func(i, j int) bool {
159-
return entitysort.ByChannelAndVersion(entities[i], entities[j])
85+
return entitysort.ByPackageAndVersion(entities[i], entities[j])
16086
})
16187
if diff := cmp.Diff(entities[0], e3); diff != "" {
16288
t.Error(diff)

internal/resolution/variables/bundle_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@ import (
1515
func TestBundleVariable(t *testing.T) {
1616
bundleEntity := olmentity.NewBundleEntity(input.NewEntity("bundle-1", map[string]string{
1717
property.TypePackage: `{"packageName": "test-package", "version": "1.0.0"}`,
18-
property.TypeChannel: `{"channelName":"stable","priority":0}`,
18+
property.TypeChannel: `{"channelName":"stable"`,
1919
}))
2020
dependencies := []*olmentity.BundleEntity{
2121
olmentity.NewBundleEntity(input.NewEntity("bundle-2", map[string]string{
2222
property.TypePackage: `{"packageName": "test-package-2", "version": "2.0.0"}`,
23-
property.TypeChannel: `{"channelName":"stable","priority":0}`,
23+
property.TypeChannel: `{"channelName":"stable"}`,
2424
})),
2525
olmentity.NewBundleEntity(input.NewEntity("bundle-3", map[string]string{
2626
property.TypePackage: `{"packageName": "test-package-3", "version": "2.0.0"}`,
27-
property.TypeChannel: `{"channelName":"stable","priority":0}`,
27+
property.TypeChannel: `{"channelName":"stable"}`,
2828
})),
2929
}
3030
bv := olmvariables.NewBundleVariable(bundleEntity, dependencies)

internal/resolution/variables/installed_package_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ func TestInstalledPackageVariable(t *testing.T) {
1717
bundleEntities := []*olmentity.BundleEntity{
1818
olmentity.NewBundleEntity(input.NewEntity("bundle-1", map[string]string{
1919
property.TypePackage: `{"packageName": "test-package", "version": "1.0.0"}`,
20-
property.TypeChannel: `{"channelName":"stable","priority":0}`,
20+
property.TypeChannel: `{"channelName":"stable"}`,
2121
})),
2222
olmentity.NewBundleEntity(input.NewEntity("bundle-2", map[string]string{
2323
property.TypePackage: `{"packageName": "test-package", "version": "2.0.0"}`,
24-
property.TypeChannel: `{"channelName":"stable","priority":0}`,
24+
property.TypeChannel: `{"channelName":"stable"}`,
2525
})),
2626
olmentity.NewBundleEntity(input.NewEntity("bundle-3", map[string]string{
2727
property.TypePackage: `{"packageName": "test-package", "version": "3.0.0"}`,
28-
property.TypeChannel: `{"channelName":"stable","priority":0}`,
28+
property.TypeChannel: `{"channelName":"stable"}`,
2929
})),
3030
}
3131
ipv := olmvariables.NewInstalledPackageVariable(packageName, bundleEntities)

internal/resolution/variables/required_package_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ func TestRequiredPackageVariable(t *testing.T) {
1717
bundleEntities := []*olmentity.BundleEntity{
1818
olmentity.NewBundleEntity(input.NewEntity("bundle-1", map[string]string{
1919
property.TypePackage: `{"packageName": "test-package", "version": "1.0.0"}`,
20-
property.TypeChannel: `{"channelName":"stable","priority":0}`,
20+
property.TypeChannel: `{"channelName":"stable"}`,
2121
})),
2222
olmentity.NewBundleEntity(input.NewEntity("bundle-2", map[string]string{
2323
property.TypePackage: `{"packageName": "test-package", "version": "2.0.0"}`,
24-
property.TypeChannel: `{"channelName":"stable","priority":0}`,
24+
property.TypeChannel: `{"channelName":"stable"}`,
2525
})),
2626
olmentity.NewBundleEntity(input.NewEntity("bundle-3", map[string]string{
2727
property.TypePackage: `{"packageName": "test-package", "version": "3.0.0"}`,
28-
property.TypeChannel: `{"channelName":"stable","priority":0}`,
28+
property.TypeChannel: `{"channelName":"stable"}`,
2929
})),
3030
}
3131
rpv := olmvariables.NewRequiredPackageVariable(packageName, bundleEntities)

internal/resolution/variablesources/bundle_deployment_test.go

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,17 @@ import (
55

66
. "github.com/onsi/ginkgo/v2"
77
. "github.com/onsi/gomega"
8-
9-
olmvariables "github.com/operator-framework/operator-controller/internal/resolution/variables"
10-
"github.com/operator-framework/operator-controller/internal/resolution/variablesources"
11-
8+
"github.com/operator-framework/deppy/pkg/deppy"
9+
"github.com/operator-framework/deppy/pkg/deppy/input"
10+
rukpakv1alpha1 "github.com/operator-framework/rukpak/api/v1alpha1"
1211
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1312
"k8s.io/apimachinery/pkg/runtime"
1413
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
1514
"sigs.k8s.io/controller-runtime/pkg/client"
1615
"sigs.k8s.io/controller-runtime/pkg/client/fake"
1716

18-
"github.com/operator-framework/deppy/pkg/deppy"
19-
"github.com/operator-framework/deppy/pkg/deppy/input"
20-
rukpakv1alpha1 "github.com/operator-framework/rukpak/api/v1alpha1"
17+
olmvariables "github.com/operator-framework/operator-controller/internal/resolution/variables"
18+
"github.com/operator-framework/operator-controller/internal/resolution/variablesources"
2119
)
2220

2321
func BundleDeploymentFakeClient(objects ...client.Object) client.Client {
@@ -51,21 +49,21 @@ var BundleDeploymentTestEntityCache = map[deppy.Identifier]input.Entity{
5149
"operatorhub/prometheus/0.37.0": *input.NewEntity("operatorhub/prometheus/0.37.0", map[string]string{
5250
"olm.bundle.path": `"quay.io/operatorhubio/prometheus@sha256:3e281e587de3d03011440685fc4fb782672beab044c1ebadc42788ce05a21c35"`,
5351
"olm.bundle.channelEntry": "{\"name\":\"prometheus.0.37.0\"}",
54-
"olm.channel": "{\"channelName\":\"beta\",\"priority\":0,\"replaces\":\"prometheusoperator.0.32.0\"}",
52+
"olm.channel": "{\"channelName\":\"beta\",\"replaces\":\"prometheusoperator.0.32.0\"}",
5553
"olm.gvk": "[{\"group\":\"monitoring.coreos.com\",\"kind\":\"Alertmanager\",\"version\":\"v1\"}, {\"group\":\"monitoring.coreos.com\",\"kind\":\"Prometheus\",\"version\":\"v1\"}]",
5654
"olm.package": "{\"packageName\":\"prometheus\",\"version\":\"0.37.0\"}",
5755
}),
5856
"operatorhub/prometheus/0.47.0": *input.NewEntity("operatorhub/prometheus/0.47.0", map[string]string{
5957
"olm.bundle.path": `"quay.io/operatorhubio/prometheus@sha256:5b04c49d8d3eff6a338b56ec90bdf491d501fe301c9cdfb740e5bff6769a21ed"`,
6058
"olm.bundle.channelEntry": "{\"replaces\":\"prometheus.0.37.0\", \"name\":\"prometheus.0.47.0\"}",
61-
"olm.channel": "{\"channelName\":\"beta\",\"priority\":0,\"replaces\":\"prometheusoperator.0.37.0\"}",
59+
"olm.channel": "{\"channelName\":\"beta\",\"replaces\":\"prometheusoperator.0.37.0\"}",
6260
"olm.gvk": "[{\"group\":\"monitoring.coreos.com\",\"kind\":\"Alertmanager\",\"version\":\"v1\"}, {\"group\":\"monitoring.coreos.com\",\"kind\":\"Prometheus\",\"version\":\"v1alpha1\"}]",
6361
"olm.package": "{\"packageName\":\"prometheus\",\"version\":\"0.47.0\"}",
6462
}),
6563
"operatorhub/packageA/2.0.0": *input.NewEntity("operatorhub/packageA/2.0.0", map[string]string{
6664
"olm.bundle.path": `"foo.io/packageA/packageA:v2.0.0"`,
6765
"olm.bundle.channelEntry": "{\"name\":\"packageA.2.0.0\"}",
68-
"olm.channel": "{\"channelName\":\"stable\",\"priority\":0}",
66+
"olm.channel": "{\"channelName\":\"stable\"}",
6967
"olm.gvk": "[{\"group\":\"foo.io\",\"kind\":\"Foo\",\"version\":\"v1\"}]",
7068
"olm.package": "{\"packageName\":\"packageA\",\"version\":\"2.0.0\"}",
7169
}),

internal/resolution/variablesources/bundles_and_dependencies.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ func (b *BundlesAndDepsVariableSource) getEntityDependencies(ctx context.Context
109109

110110
// sort bundles in version order
111111
sort.SliceStable(dependencies, func(i, j int) bool {
112-
return entitysort.ByChannelAndVersion(dependencies[i].Entity, dependencies[j].Entity)
112+
return entitysort.ByPackageAndVersion(dependencies[i].Entity, dependencies[j].Entity)
113113
})
114114

115115
return dependencies, nil

0 commit comments

Comments
 (0)