Skip to content

Commit b308d7a

Browse files
committed
readds working dir and pull from registry
1 parent f2f93c7 commit b308d7a

1 file changed

Lines changed: 18 additions & 18 deletions

File tree

vulndb/vulndb_service.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import (
3030
"github.com/l3montree-dev/devguard/shared"
3131
"github.com/sigstore/sigstore/pkg/signature"
3232
"github.com/sigstore/sigstore/pkg/signature/options"
33+
"go.opentelemetry.io/otel/codes"
3334
"golang.org/x/sync/errgroup"
3435
"oras.land/oras-go/v2"
3536
"oras.land/oras-go/v2/content/file"
@@ -307,24 +308,23 @@ func (s *VulnDBService) ExportRC(ctx context.Context) error {
307308
// If the integrity check fails after an incremental import, it alerts and retries
308309
// as a full import (ignoring the last-import watermark).
309310
func (s *VulnDBService) ImportRC(ctx context.Context) (err error) {
310-
// ctx, span := vulndbTracer.Start(ctx, "VulnDBService.ImportRC")
311-
// defer func() {
312-
// if err != nil {
313-
// span.RecordError(err)
314-
// span.SetStatus(codes.Error, err.Error())
315-
// }
316-
// span.End()
317-
// }()
318-
319-
// slog.Info("start vulndb import")
320-
// start := time.Now()
321-
322-
// workingDir, err := pullVulnDBFromPackageRegistry(ctx)
323-
// if err != nil {
324-
// return fmt.Errorf("could not pull from remote repository: %w", err)
325-
// }
326-
// defer os.RemoveAll(workingDir)
327-
workingDir := "."
311+
ctx, span := vulndbTracer.Start(ctx, "VulnDBService.ImportRC")
312+
defer func() {
313+
if err != nil {
314+
span.RecordError(err)
315+
span.SetStatus(codes.Error, err.Error())
316+
}
317+
span.End()
318+
}()
319+
320+
slog.Info("start vulndb import")
321+
start := time.Now()
322+
323+
workingDir, err := pullVulnDBFromPackageRegistry(ctx)
324+
if err != nil {
325+
return fmt.Errorf("could not pull from remote repository: %w", err)
326+
}
327+
defer os.RemoveAll(workingDir)
328328

329329
var lastImportTime time.Time
330330
var lastImportStr string

0 commit comments

Comments
 (0)