mirror of
https://github.com/project-zot/zot.git
synced 2026-06-16 04:17:55 +08:00
feat(cve): implemented trivy image scan for multiarch images (#1510)
Signed-off-by: Laurentiu Niculae <niculae.laurentiu1@gmail.com>
This commit is contained in:
+1
-1
@@ -112,7 +112,7 @@ type Annotation struct {
|
||||
Value string `json:"value"`
|
||||
}
|
||||
|
||||
type FixedTags struct {
|
||||
type ImageListWithCVEFixedResponse struct {
|
||||
Errors []ErrorGQL `json:"errors"`
|
||||
ImageListWithCVEFixed `json:"data"`
|
||||
}
|
||||
|
||||
+21
-1
@@ -4,6 +4,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/opencontainers/go-digest"
|
||||
ispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
|
||||
zerr "zotregistry.io/zot/errors"
|
||||
@@ -101,7 +102,7 @@ func GetRepoRefference(repo string) (string, string, bool, error) {
|
||||
repoName, tag, found := strings.Cut(repo, ":")
|
||||
|
||||
if !found {
|
||||
return "", "", false, zerr.ErrInvalidRepoTagFormat
|
||||
return "", "", false, zerr.ErrInvalidRepoRefFormat
|
||||
}
|
||||
|
||||
return repoName, tag, true, nil
|
||||
@@ -109,3 +110,22 @@ func GetRepoRefference(repo string) (string, string, bool, error) {
|
||||
|
||||
return repoName, digest, false, nil
|
||||
}
|
||||
|
||||
// GetFullImageName returns the formated string for the given repo/tag or repo/digest.
|
||||
func GetFullImageName(repo, ref string) string {
|
||||
if IsTag(ref) {
|
||||
return repo + ":" + ref
|
||||
}
|
||||
|
||||
return repo + "@" + ref
|
||||
}
|
||||
|
||||
func IsDigest(ref string) bool {
|
||||
_, err := digest.Parse(ref)
|
||||
|
||||
return err == nil
|
||||
}
|
||||
|
||||
func IsTag(ref string) bool {
|
||||
return !IsDigest(ref)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user