Skip to content

Commit

Permalink
Prune a few dependencies from ./pkg/oci (#1085)
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Moore <[email protected]>
  • Loading branch information
mattmoor authored Nov 20, 2021
1 parent eed3e12 commit 90e2dcf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
5 changes: 3 additions & 2 deletions pkg/oci/static/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
package static

import (
"github.com/go-openapi/swag"
"encoding/json"

"github.com/google/go-containerregistry/pkg/v1/types"
"github.com/sigstore/cosign/pkg/oci"
ctypes "github.com/sigstore/cosign/pkg/types"
Expand Down Expand Up @@ -51,7 +52,7 @@ func makeOptions(opts ...Option) (*options, error) {
}

if o.Bundle != nil {
b, err := swag.WriteJSON(o.Bundle)
b, err := json.Marshal(o.Bundle)
if err != nil {
return nil, err
}
Expand Down
10 changes: 6 additions & 4 deletions pkg/oci/static/signature.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"github.com/google/go-containerregistry/pkg/v1/types"
"github.com/sigstore/cosign/pkg/oci"
"github.com/sigstore/sigstore/pkg/cryptoutils"
"knative.dev/pkg/kmeta"
)

const (
Expand Down Expand Up @@ -66,9 +65,12 @@ var _ oci.Signature = (*staticLayer)(nil)

// Annotations implements oci.Signature
func (l *staticLayer) Annotations() (map[string]string, error) {
return kmeta.UnionMaps(l.opts.Annotations, map[string]string{
SignatureAnnotationKey: l.b64sig,
}), nil
m := make(map[string]string, len(l.opts.Annotations)+1)
for k, v := range l.opts.Annotations {
m[k] = v
}
m[SignatureAnnotationKey] = l.b64sig
return m, nil
}

// Payload implements oci.Signature
Expand Down

0 comments on commit 90e2dcf

Please sign in to comment.