Skip to content

Commit

Permalink
Exclude the special keys from the annotation comparison.
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Moore <[email protected]>
  • Loading branch information
mattmoor committed Sep 21, 2021
1 parent 686c540 commit 8229e66
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/cosign/remote/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
"github.com/google/go-containerregistry/pkg/v1/remote/transport"
"github.com/google/go-containerregistry/pkg/v1/types"
"github.com/pkg/errors"
"k8s.io/apimachinery/pkg/util/sets"
"knative.dev/pkg/kmeta"

"github.com/sigstore/cosign/internal/oci"
Expand All @@ -49,6 +50,8 @@ const (
BundleKey = "dev.sigstore.cosign/bundle"
)

var specialKeys = sets.NewString(sigkey, certkey, chainkey, BundleKey)

func Descriptors(ref name.Reference, remoteOpts ...remote.Option) ([]v1.Descriptor, error) {
img, err := remote.Image(ref, remoteOpts...)
if err != nil {
Expand Down Expand Up @@ -103,8 +106,12 @@ LayerLoop:
if err != nil {
continue LayerLoop
}

// if there are any new annotations, then this isn't a duplicate
for a, value := range newAnnotations {
if specialKeys.Has(a) {
continue // Ignore the special keys, we check those below.
}
if val, ok := existingAnnotations[a]; !ok || val != value {
continue LayerLoop
}
Expand Down

0 comments on commit 8229e66

Please sign in to comment.