From 2a01d8faad83a4b9cbc3382828597ac54607750f Mon Sep 17 00:00:00 2001 From: Arvind Somya Date: Mon, 6 May 2024 14:46:36 -0400 Subject: [PATCH] Revert "feat: add last successful run for each provider to the metadata (#292)" This reverts commit 4efacf41a9f2369bfadc98a30a669c3347385442. Signed-off-by: Arvind Somya --- pkg/process/build.go | 6 +++--- pkg/process/v5/writer.go | 14 +------------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/pkg/process/build.go b/pkg/process/build.go index 16254505..39acf874 100644 --- a/pkg/process/build.go +++ b/pkg/process/build.go @@ -43,7 +43,7 @@ func Build(cfg BuildConfig) error { return err } - writer, err := getWriter(cfg.SchemaVersion, cfg.Timestamp, cfg.Directory, cfg.States) + writer, err := getWriter(cfg.SchemaVersion, cfg.Timestamp, cfg.Directory) if err != nil { return err } @@ -106,7 +106,7 @@ func getProcessors(schemaVersion int) ([]data.Processor, error) { } } -func getWriter(schemaVersion int, dataAge time.Time, directory string, states provider.States) (data.Writer, error) { +func getWriter(schemaVersion int, dataAge time.Time, directory string) (data.Writer, error) { switch schemaVersion { case grypeDBv1.SchemaVersion: return v1.NewWriter(directory, dataAge) @@ -117,7 +117,7 @@ func getWriter(schemaVersion int, dataAge time.Time, directory string, states pr case grypeDBv4.SchemaVersion: return v4.NewWriter(directory, dataAge) case grypeDBv5.SchemaVersion: - return v5.NewWriter(directory, dataAge, states) + return v5.NewWriter(directory, dataAge) default: return nil, fmt.Errorf("unable to create writer: unsupported schema version: %+v", schemaVersion) } diff --git a/pkg/process/v5/writer.go b/pkg/process/v5/writer.go index dfd6f6e2..2ec89bbe 100644 --- a/pkg/process/v5/writer.go +++ b/pkg/process/v5/writer.go @@ -13,7 +13,6 @@ import ( "github.com/anchore/grype-db/internal/file" "github.com/anchore/grype-db/internal/log" "github.com/anchore/grype-db/pkg/data" - "github.com/anchore/grype-db/pkg/provider" "github.com/anchore/grype/grype/db" grypeDB "github.com/anchore/grype/grype/db/v5" grypeDBStore "github.com/anchore/grype/grype/db/v5/store" @@ -27,10 +26,9 @@ var _ data.Writer = (*writer)(nil) type writer struct { dbPath string store grypeDB.Store - states provider.States } -func NewWriter(directory string, dataAge time.Time, states provider.States) (data.Writer, error) { +func NewWriter(directory string, dataAge time.Time) (data.Writer, error) { dbPath := path.Join(directory, grypeDB.VulnerabilityStoreFileName) theStore, err := grypeDBStore.New(dbPath, true) if err != nil { @@ -44,7 +42,6 @@ func NewWriter(directory string, dataAge time.Time, states provider.States) (dat return &writer{ dbPath: dbPath, store: theStore, - states: states, }, nil } @@ -93,15 +90,6 @@ func (w writer) metadata() (*db.Metadata, error) { Version: storeID.SchemaVersion, Checksum: "sha256:" + hashStr, } - - // Set provider time from states - for _, state := range w.states { - metadata.Providers = append(metadata.Providers, db.Provider{ - Name: state.Provider, - LastSuccessfulRun: state.Timestamp, - }) - } - return &metadata, nil }