From e960abf217eb8385ee4d99e824784d04ddfd9b4c Mon Sep 17 00:00:00 2001 From: Kostas Stamatakis Date: Tue, 14 May 2024 17:27:53 +0300 Subject: [PATCH] fix --- internal/vulnerability/runner.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/vulnerability/runner.go b/internal/vulnerability/runner.go index bd2c83fe0e..b34c196e97 100644 --- a/internal/vulnerability/runner.go +++ b/internal/vulnerability/runner.go @@ -83,7 +83,7 @@ func clearTrivyCache(ctx context.Context, log *logp.Logger) error { options := []flag.Options{ {CacheOptions: flag.CacheOptions{ClearCache: true}}, {DBOptions: flag.DBOptions{Reset: true}}, - {MisconfOptions: flag.MisconfOptions{ResetPolicyBundle: true}}, + // {MisconfOptions: flag.MisconfOptions{ResetPolicyBundle: true}}, } errs := make([]error, 0, len(options)) @@ -94,13 +94,13 @@ func clearTrivyCache(ctx context.Context, log *logp.Logger) error { if !errors.Is(err, artifact.SkipScan) { errs = append(errs, err) } - continue } - // it should never go here (NewRunner should always return artifact.SkipScan), but just in case it goes, lets close the runner. - errs = append(errs, r.Close(ctx)) + // it should never go here (NewRunner should always return artifact.SkipScan and nil runner), but just in case it goes, lets close the runner. + if r != nil { + errs = append(errs, r.Close(ctx)) + } } - log.Infof("Ending VulnerabilityRunner.ClearCache %d", len(errs)) return errors.Join(errs...)