Skip to content

Commit 4954236

Browse files
committed
revert replace back to append index - bugfix
Signed-off-by: Adam Martin <adam.martin@rancherfederal.com>
1 parent cb81c50 commit 4954236

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

pkg/oci/layout/write.go

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import (
2525
v1 "github.com/google/go-containerregistry/pkg/v1"
2626
"github.com/google/go-containerregistry/pkg/v1/empty"
2727
"github.com/google/go-containerregistry/pkg/v1/layout"
28-
"github.com/google/go-containerregistry/pkg/v1/match"
2928
"github.com/sigstore/cosign/v2/pkg/oci"
3029
)
3130

@@ -63,11 +62,7 @@ func WriteSignedImageIndex(path string, si oci.SignedImageIndex, ref name.Refere
6362
if err != nil {
6463
return err // Return the error from getImageRef immediately.
6564
}
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(
7166
map[string]string{KindAnnotation: ImageIndexAnnotation, ImageRefAnnotation: imageRef},
7267
)); err != nil {
7368
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
122117
if err != nil {
123118
return err // Return the error from getImageRef immediately.
124119
}
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(
130121
map[string]string{KindAnnotation: annotation, ImageRefAnnotation: imageRef},
131122
))
132123
}

0 commit comments

Comments
 (0)