mirror of
https://github.com/project-zot/zot.git
synced 2026-06-17 04:48:26 +08:00
fix: add support for uploaded index when signing using notation (#1882)
ci(notation): update to latest notation version fix(sync): add layers info when syncing signatures Signed-off-by: Andreea-Lupu <andreealupu1470@yahoo.com>
This commit is contained in:
@@ -347,6 +347,33 @@ func TestParseStorageErrors(t *testing.T) {
|
||||
err = meta.ParseRepo("repo", metaDB, storeController, log)
|
||||
So(err, ShouldNotBeNil)
|
||||
})
|
||||
|
||||
Convey("IsReferrersTag -> true", func() {
|
||||
indexContent := ispec.Index{
|
||||
Manifests: []ispec.Descriptor{
|
||||
{
|
||||
Digest: godigest.FromString("indx1"),
|
||||
MediaType: ispec.MediaTypeImageIndex,
|
||||
Annotations: map[string]string{
|
||||
ispec.AnnotationRefName: "sha256-123",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
indexBlob, err := json.Marshal(indexContent)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
imageStore.GetIndexContentFn = func(repo string) ([]byte, error) {
|
||||
return indexBlob, nil
|
||||
}
|
||||
|
||||
metaDB.SetIndexDataFn = func(digest godigest.Digest, indexData mTypes.IndexData) error {
|
||||
return ErrTestError
|
||||
}
|
||||
|
||||
err = meta.ParseRepo("repo", metaDB, storeController, log)
|
||||
So(err, ShouldBeNil)
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -605,6 +632,19 @@ func TestGetSignatureLayersInfo(t *testing.T) {
|
||||
So(layers, ShouldBeEmpty)
|
||||
})
|
||||
|
||||
Convey("notation index", t, func() {
|
||||
notationIndex := ispec.Index{
|
||||
MediaType: ispec.MediaTypeImageIndex,
|
||||
}
|
||||
|
||||
notationIndexBlob, err := json.Marshal(notationIndex)
|
||||
So(err, ShouldBeNil)
|
||||
layers, err := meta.GetSignatureLayersInfo("repo", "tag", "123", zcommon.NotationSignature, notationIndexBlob,
|
||||
nil, log.NewLogger("debug", ""))
|
||||
So(err, ShouldBeNil)
|
||||
So(layers, ShouldBeEmpty)
|
||||
})
|
||||
|
||||
Convey("error while unmarshaling manifest content", t, func() {
|
||||
_, err := meta.GetSignatureLayersInfo("repo", "tag", "123", zcommon.CosignSignature, []byte("bad manifest"),
|
||||
nil, log.NewLogger("debug", ""))
|
||||
|
||||
Reference in New Issue
Block a user