feat(sync): sync references(signatures/artifacts) recursively (#1500)

sync now also pulls chained artifacts recursively
eg:
 image->sbom->sbom signature
 image->artifact->artifact

Signed-off-by: Petu Eusebiu <peusebiu@cisco.com>
This commit is contained in:
peusebiu
2023-06-16 20:27:33 +03:00
committed by GitHub
parent c41bf02240
commit fc6d6356fb
11 changed files with 447 additions and 222 deletions
+3 -14
View File
@@ -18,7 +18,6 @@ import (
"unicode/utf8"
"github.com/gorilla/mux"
"github.com/opencontainers/go-digest"
ispec "github.com/opencontainers/image-spec/specs-go/v1"
"zotregistry.io/zot/pkg/log"
@@ -37,9 +36,9 @@ func AllowedMethods(methods ...string) []string {
return append(methods, http.MethodOptions)
}
func Contains(slice []string, item string) bool {
for _, v := range slice {
if item == v {
func Contains[T comparable](elems []T, v T) bool {
for _, s := range elems {
if v == s {
return true
}
}
@@ -271,16 +270,6 @@ func MarshalThroughStruct(obj interface{}, throughStruct interface{}) ([]byte, e
return toJSON, nil
}
func DContains(slice []digest.Digest, item digest.Digest) bool {
for _, v := range slice {
if item == v {
return true
}
}
return false
}
func GetManifestArtifactType(manifestContent ispec.Manifest) string {
if manifestContent.ArtifactType != "" {
return manifestContent.ArtifactType