Add --refresh option

This commit is contained in:
knqyf263
2019-05-08 19:10:08 +09:00
parent 53ad8c2f35
commit b208bc4c12
5 changed files with 75 additions and 6 deletions

View File

@@ -5,6 +5,8 @@ import (
"path/filepath"
"strings"
"github.com/knqyf263/trivy/pkg/db"
"github.com/knqyf263/trivy/pkg/log"
"github.com/knqyf263/trivy/pkg/utils"
"golang.org/x/xerrors"
@@ -52,6 +54,10 @@ func CloneOrPull(url, repoPath string) (map[string]struct{}, error) {
return nil, xerrors.Errorf("failed to clone repository: %w", err)
}
}
// Need to refresh all vulnerabilities
if db.GetVersion() == "" {
err = filepath.Walk(repoPath, func(path string, info os.FileInfo, err error) error {
if info.IsDir() {
return nil