@@ -25,7 +25,6 @@ import (
25
25
v1 "github.com/google/go-containerregistry/pkg/v1"
26
26
"github.com/google/go-containerregistry/pkg/v1/empty"
27
27
"github.com/google/go-containerregistry/pkg/v1/layout"
28
- "github.com/google/go-containerregistry/pkg/v1/match"
29
28
"github.com/sigstore/cosign/v2/pkg/oci"
30
29
)
31
30
@@ -63,11 +62,7 @@ func WriteSignedImageIndex(path string, si oci.SignedImageIndex, ref name.Refere
63
62
if err != nil {
64
63
return err // Return the error from getImageRef immediately.
65
64
}
66
- digest , err := si .Digest ()
67
- if err != nil {
68
- return err
69
- }
70
- if err := layoutPath .ReplaceIndex (si , match .Digests (digest ), layout .WithAnnotations (
65
+ if err := layoutPath .AppendIndex (si , layout .WithAnnotations (
71
66
map [string ]string {KindAnnotation : ImageIndexAnnotation , ImageRefAnnotation : imageRef },
72
67
)); err != nil {
73
68
return fmt .Errorf ("appending signed image index: %w" , err )
@@ -122,11 +117,7 @@ func appendImage(path layout.Path, img v1.Image, ref name.Reference, annotation
122
117
if err != nil {
123
118
return err // Return the error from getImageRef immediately.
124
119
}
125
- digest , err := img .Digest ()
126
- if err != nil {
127
- return err
128
- }
129
- return path .ReplaceImage (img , match .Digests (digest ), layout .WithAnnotations (
120
+ return path .AppendImage (img , layout .WithAnnotations (
130
121
map [string ]string {KindAnnotation : annotation , ImageRefAnnotation : imageRef },
131
122
))
132
123
}
0 commit comments