Skip to content

Commit

Permalink
Revert "feat: add last successful run for each provider to the metada…
Browse files Browse the repository at this point in the history
…ta (#292)"

This reverts commit 4efacf4.

Signed-off-by: Arvind Somya <[email protected]>
  • Loading branch information
asomya committed May 6, 2024
1 parent 758cb96 commit 2a01d8f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
6 changes: 3 additions & 3 deletions pkg/process/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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)
Expand All @@ -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)
}
Expand Down
14 changes: 1 addition & 13 deletions pkg/process/v5/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 {
Expand All @@ -44,7 +42,6 @@ func NewWriter(directory string, dataAge time.Time, states provider.States) (dat
return &writer{
dbPath: dbPath,
store: theStore,
states: states,
}, nil
}

Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 2a01d8f

Please sign in to comment.