Skip to content

Commit

Permalink
Inline GGCR interface, presere annotations.
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Moore <[email protected]>
  • Loading branch information
mattmoor committed Sep 20, 2021
1 parent b587a2a commit 53e8d40
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 5 additions & 1 deletion internal/oci/mutate/map.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,12 @@ func Map(ctx context.Context, parent oci.SignedEntity, fn Mutator) (oci.SignedEn
return parent, nil
}

// Preserve the key attributes from the base IndexManifest.
e := mutate.IndexMediaType(empty.Index, im.MediaType)
e = mutate.Annotations(e, im.Annotations).(v1.ImageIndex)

// Construct a new ImageIndex from the new consituent signed images.
result := AppendManifests(mutate.IndexMediaType(empty.Index, im.MediaType), adds...)
result := AppendManifests(e, adds...)

// Since the children changed, give the callback a crack at the new image index.
return fn(after(ctx), result)
Expand Down
6 changes: 1 addition & 5 deletions internal/oci/mutate/mutate.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (

v1 "github.com/google/go-containerregistry/pkg/v1"
"github.com/google/go-containerregistry/pkg/v1/mutate"
"github.com/google/go-containerregistry/pkg/v1/types"
"github.com/sigstore/cosign/internal/oci"
"github.com/sigstore/cosign/internal/oci/empty"
"github.com/sigstore/cosign/internal/oci/signed"
Expand All @@ -29,10 +28,7 @@ import (
// Appendable is our signed version of mutate.Appendable
type Appendable interface {
oci.SignedEntity

MediaType() (types.MediaType, error)
Digest() (v1.Hash, error)
Size() (int64, error)
mutate.Appendable
}

// IndexAddendum is our signed version of mutate.IndexAddendum
Expand Down

0 comments on commit 53e8d40

Please sign in to comment.