Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ require (
go.etcd.io/bbolt v1.5.0
go.podman.io/common v0.68.0
go.podman.io/image/v5 v5.40.0
go.yaml.in/yaml/v3 v3.0.4
Comment thread
chimanjain marked this conversation as resolved.
golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f
golang.org/x/mod v0.37.0
Comment thread
chimanjain marked this conversation as resolved.
golang.org/x/sync v0.21.0
Expand All @@ -43,7 +44,6 @@ require (
google.golang.org/grpc v1.81.1
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.6.2
google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af
gopkg.in/yaml.v2 v2.4.0
k8s.io/api v0.36.2
k8s.io/apiextensions-apiserver v0.36.2
k8s.io/apimachinery v0.36.2
Expand Down Expand Up @@ -201,7 +201,6 @@ require (
go.opentelemetry.io/proto/otlp v1.10.0 // indirect
go.podman.io/storage v1.63.0 // indirect
go.yaml.in/yaml/v2 v2.4.3 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/crypto v0.53.0 // indirect
golang.org/x/net v0.56.0 // indirect
golang.org/x/oauth2 v0.36.0 // indirect
Expand All @@ -214,6 +213,7 @@ require (
gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiserver v0.36.2 // indirect
k8s.io/cli-runtime v0.36.1 // indirect
Expand Down
2 changes: 1 addition & 1 deletion pkg/lib/bundle/chartutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"path/filepath"

"github.com/pkg/errors"
"gopkg.in/yaml.v2"
"go.yaml.in/yaml/v3"
)

// Maintainer describes a Chart maintainer.
Expand Down
14 changes: 10 additions & 4 deletions pkg/lib/bundle/generate.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package bundle

import (
"bytes"
"fmt"
"io"
"os"
"path/filepath"
"strings"

log "github.com/sirupsen/logrus"
"gopkg.in/yaml.v2"
"go.yaml.in/yaml/v3"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
utilerrors "k8s.io/apimachinery/pkg/util/errors"
k8syaml "k8s.io/apimachinery/pkg/util/yaml"
Expand Down Expand Up @@ -315,12 +316,17 @@ func GenerateAnnotations(mediaType, manifests, metadata, packageName, channels,
annotations.Annotations[ChannelDefaultLabel] = channelDefault
}

afile, err := yaml.Marshal(annotations)
if err != nil {
var buf bytes.Buffer
encoder := yaml.NewEncoder(&buf)
encoder.SetIndent(2)
if err := encoder.Encode(annotations); err != nil {
return nil, err
}
if err := encoder.Close(); err != nil {
return nil, err
}

return afile, nil
return buf.Bytes(), nil
}

// GenerateDockerfile builds Dockerfile with mediatype, manifests &
Expand Down
2 changes: 1 addition & 1 deletion pkg/lib/bundle/generate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"testing"

"github.com/stretchr/testify/require"
"gopkg.in/yaml.v2"
"go.yaml.in/yaml/v3"
)

func TestGetMediaType(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/lib/bundle/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"os"
"path/filepath"

"gopkg.in/yaml.v2"
"go.yaml.in/yaml/v3"
)

const (
Expand Down
6 changes: 3 additions & 3 deletions pkg/lib/bundle/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func TestValidateBundleDependencies(t *testing.T) {
logger: logger,
}

var table = []struct {
table := []struct {
description string
mediaType string
directory string
Expand Down Expand Up @@ -108,7 +108,7 @@ func TestValidateBundleContent(t *testing.T) {
logger: logger,
}

var table = []struct {
table := []struct {
description string
mediaType string
directory string
Expand All @@ -134,7 +134,7 @@ func TestValidateBundleContent(t *testing.T) {
mediaType: RegistryV1Type,
directory: "./testdata/validate/invalid_manifests_bundle/invalid_sa/",
numErrors: 1,
errStrings: []string{"json: cannot unmarshal number into Go struct field ObjectMeta.metadata.namespace of type string"},
errStrings: []string{"json: cannot unmarshal number into Go struct field Meta.metadata.namespace of type string"},
},
{
description: "registryv1 bundle/invalid type",
Expand Down
2 changes: 1 addition & 1 deletion pkg/lib/indexer/indexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"sync"

"github.com/sirupsen/logrus"
"gopkg.in/yaml.v2"
"go.yaml.in/yaml/v3"
utilerrors "k8s.io/apimachinery/pkg/util/errors"

"github.com/operator-framework/operator-registry/pkg/containertools"
Expand Down
4 changes: 2 additions & 2 deletions pkg/prettyunmarshaler/prettyunmarshaler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ func TestJsonUnmarshalError(t *testing.T) {
//
// If the data does not cause a syntax error, this function will panic.
func customOffsetSyntaxError(data []byte, offset int64) *json.SyntaxError {
var d *byte = nil
var d byte
var se *json.SyntaxError
err := json.Unmarshal(data, d)
err := json.Unmarshal(data, &d)
if errors.As(err, &se) {
se.Offset = offset
return se
Expand Down
11 changes: 7 additions & 4 deletions pkg/sqlite/directory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/otiai10/copy"
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/require"
"gopkg.in/yaml.v2"
"go.yaml.in/yaml/v3"

"github.com/operator-framework/operator-registry/pkg/api"
"github.com/operator-framework/operator-registry/pkg/registry"
Expand Down Expand Up @@ -206,13 +206,16 @@ func TestQuerierForDirectory(t *testing.T) {
{"etcd", "stable", "etcdoperator.v0.6.1", ""},
{"etcd", "stable", "etcdoperator.v0.9.0", "etcdoperator.v0.6.1"},
{"etcd", "stable", "etcdoperator.v0.9.2", "etcdoperator.v0.9.1"},
{"etcd", "stable", "etcdoperator.v0.9.2", "etcdoperator.v0.9.0"}}, etcdChannelEntriesThatProvide)
{"etcd", "stable", "etcdoperator.v0.9.2", "etcdoperator.v0.9.0"},
}, etcdChannelEntriesThatProvide)

etcdLatestChannelEntriesThatProvide, err := store.GetLatestChannelEntriesThatProvide(context.TODO(), "etcd.database.coreos.com", "v1beta2", "EtcdCluster")
require.NoError(t, err)
require.ElementsMatch(t, []*registry.ChannelEntry{{"etcd", "alpha", "etcdoperator.v0.9.2", "etcdoperator.v0.9.0"},
require.ElementsMatch(t, []*registry.ChannelEntry{
{"etcd", "alpha", "etcdoperator.v0.9.2", "etcdoperator.v0.9.0"},
{"etcd", "beta", "etcdoperator.v0.9.0", "etcdoperator.v0.6.1"},
{"etcd", "stable", "etcdoperator.v0.9.2", "etcdoperator.v0.9.0"}}, etcdLatestChannelEntriesThatProvide)
{"etcd", "stable", "etcdoperator.v0.9.2", "etcdoperator.v0.9.0"},
}, etcdLatestChannelEntriesThatProvide)

etcdBundleByProvides, err := store.GetBundleThatProvides(context.TODO(), "etcd.database.coreos.com", "v1beta2", "EtcdCluster")
require.NoError(t, err)
Expand Down
Loading