chore: update Trivy and Trivy dependencies (#2763)

The Trivy library now supports multiple locations from where to download the DBs.
The zot code has been updated to properly call the updated library functions.
If at some point we would want to support multiple Trivy DBs in zot, we could look into it more.

Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
This commit is contained in:
Andrei Aaron
2024-11-07 19:03:37 +02:00
committed by GitHub
parent f17dd2608a
commit a76bfd4283
3 changed files with 129 additions and 129 deletions
+9 -6
View File
@@ -52,10 +52,10 @@ func getNewScanOptions(dir string, dbRepositoryRef, javaDBRepositoryRef name.Ref
PkgTypes: []string{types.PkgTypeOS, types.PkgTypeLibrary},
},
DBOptions: flag.DBOptions{
DBRepository: dbRepositoryRef,
JavaDBRepository: javaDBRepositoryRef,
SkipDBUpdate: true,
SkipJavaDBUpdate: true,
DBRepositories: []name.Reference{dbRepositoryRef},
JavaDBRepositories: []name.Reference{javaDBRepositoryRef},
SkipDBUpdate: true,
SkipJavaDBUpdate: true,
},
ReportOptions: flag.ReportOptions{
Format: "table",
@@ -586,7 +586,10 @@ func (scanner Scanner) updateDB(ctx context.Context, dbDir string) error {
scanner.log.Debug().Str("dbDir", dbDir).Msg("started downloading trivy-db to destination dir")
err := operation.DownloadDB(ctx, "dev", dbDir, scanner.dbRepositoryRef, false, false, registryOpts)
dbRefs := []name.Reference{scanner.dbRepositoryRef}
javaDBRefs := []name.Reference{scanner.javaDBRepositoryRef}
err := operation.DownloadDB(ctx, "dev", dbDir, dbRefs, false, false, registryOpts)
if err != nil {
scanner.log.Error().Err(err).Str("dbDir", dbDir).
Str("dbRepository", scanner.dbRepositoryRef.String()).
@@ -596,7 +599,7 @@ func (scanner Scanner) updateDB(ctx context.Context, dbDir string) error {
}
if scanner.javaDBRepositoryRef != nil {
javadb.Init(dbDir, scanner.javaDBRepositoryRef, false, false, registryOpts)
javadb.Init(dbDir, javaDBRefs, false, false, registryOpts)
if err := javadb.Update(); err != nil {
scanner.log.Error().Err(err).Str("dbDir", dbDir).