[wip] more concurrent catalogers

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
This commit is contained in:
Alex Goodman
2024-10-01 10:18:44 -04:00
parent 7815d8e4d9
commit edd910f88f
8 changed files with 140 additions and 47 deletions
+3
View File
@@ -13,6 +13,7 @@ import (
"github.com/wagoodman/go-progress"
"github.com/anchore/clio"
"github.com/anchore/go-sync"
"github.com/anchore/stereoscope"
"github.com/anchore/syft/cmd/syft/internal/options"
"github.com/anchore/syft/cmd/syft/internal/ui"
@@ -252,6 +253,8 @@ func generateSBOMForAttestation(ctx context.Context, id clio.Identification, opt
return nil, fmt.Errorf("attest requires use of an OCI registry directly, one or more of the specified sources is unsupported: %v", opts.From)
}
ctx = sync.SetContextExecutor(ctx, sync.NewExecutor(opts.Parallelism))
src, err := getSource(ctx, opts, userInput, stereoscope.RegistryTag)
if err != nil {
+3
View File
@@ -14,6 +14,7 @@ import (
"github.com/anchore/clio"
"github.com/anchore/go-collections"
"github.com/anchore/go-sync"
"github.com/anchore/stereoscope"
"github.com/anchore/stereoscope/pkg/image"
"github.com/anchore/syft/cmd/syft/internal/options"
@@ -167,6 +168,8 @@ func validateArgs(cmd *cobra.Command, args []string, error string) error {
}
func runScan(ctx context.Context, id clio.Identification, opts *scanOptions, userInput string) error {
ctx = sync.SetContextExecutor(ctx, sync.NewExecutor(opts.Parallelism))
writer, err := opts.SBOMWriter()
if err != nil {
return err
+2 -1
View File
@@ -2,6 +2,7 @@ package options
import (
"fmt"
"runtime"
"sort"
"strings"
@@ -72,7 +73,7 @@ func DefaultCatalog() Catalog {
File: defaultFileConfig(),
Relationships: defaultRelationshipsConfig(),
Source: defaultSourceConfig(),
Parallelism: 1,
Parallelism: runtime.NumCPU() * 3,
}
}