feat : scan with image digest (#939)

This commit is contained in:
Tomoya Amachi
2020-03-03 16:51:06 +09:00
committed by GitHub
parent fe3f1b9924
commit 9aa0d87a21
8 changed files with 83 additions and 11 deletions

View File

@@ -298,8 +298,11 @@ func IsValidImage(c Image) error {
if c.Name == "" {
return xerrors.New("Invalid arguments : no image name")
}
if c.Tag == "" {
return xerrors.New("Invalid arguments : no image tag")
if c.Tag == "" && c.Digest == "" {
return xerrors.New("Invalid arguments : no image tag and digest")
}
if c.Tag != "" && c.Digest != "" {
return xerrors.New("Invalid arguments : you can either set image tag or digest")
}
return nil
}