Skip to content

Commit 59b6138

Browse files
authored
Merge e04391e into 49eae7b
2 parents 49eae7b + e04391e commit 59b6138

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

pkg/cache/json.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"github.com/operator-framework/operator-registry/alpha/declcfg"
1515
"github.com/operator-framework/operator-registry/pkg/api"
1616
"github.com/operator-framework/operator-registry/pkg/registry"
17+
"k8s.io/apimachinery/pkg/util/sets"
1718
)
1819

1920
var _ Cache = &JSON{}
@@ -58,8 +59,13 @@ func (q *JSON) ListBundles(ctx context.Context) ([]*api.Bundle, error) {
5859

5960
func (q *JSON) SendBundles(_ context.Context, s registry.BundleSender) error {
6061
for _, pkg := range q.packageIndex {
61-
for _, ch := range pkg.Channels {
62-
for _, b := range ch.Bundles {
62+
channels := sets.KeySet(pkg.Channels)
63+
for _, chName := range sets.List(channels) {
64+
ch := pkg.Channels[chName]
65+
66+
bundles := sets.KeySet(ch.Bundles)
67+
for _, bName := range sets.List(bundles) {
68+
b := ch.Bundles[bName]
6369
apiBundle, err := q.loadAPIBundle(apiBundleKey{pkg.Name, ch.Name, b.Name})
6470
if err != nil {
6571
return fmt.Errorf("convert bundle %q: %v", b.Name, err)

pkg/cache/pkgs.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"fmt"
66
"sort"
7+
"strings"
78

89
"github.com/operator-framework/operator-registry/alpha/declcfg"
910
"github.com/operator-framework/operator-registry/alpha/model"
@@ -34,6 +35,7 @@ func (pkgs packageIndex) GetPackage(_ context.Context, name string) (*registry.P
3435
CurrentCSVName: ch.Head,
3536
})
3637
}
38+
sort.Slice(channels, func(i, j int) bool { return strings.Compare(channels[i].Name, channels[j].Name) < 0 })
3739
return &registry.PackageManifest{
3840
PackageName: pkg.Name,
3941
Channels: channels,

0 commit comments

Comments
 (0)