Skip to content

Commit

Permalink
Ignore assets with no platform. Ensure container registry assets have…
Browse files Browse the repository at this point in the history
… a platform (#2453)

* Ignore assets with no platform. Ensure container registry assets have a platform.

* Add comment.
  • Loading branch information
preslavgerchev authored Nov 2, 2023
1 parent 91bad9e commit 8293e9e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 5 additions & 1 deletion explorer/scan/local_scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,17 +267,21 @@ func (s *LocalScanner) distributeJob(job *Job, ctx context.Context, upstream *up
}
}
runtime.SetRecording(candidate.runtime.Recording)

err = runtime.Connect(&plugin.ConnectReq{
Features: config.Features,
Asset: candidate.asset,
Upstream: upstream,
})

if err != nil {
log.Error().Err(err).Str("asset", candidate.asset.Name).Msg("unable to connect to asset")
continue
}

if candidate.asset.GetPlatform() == nil {
log.Error().Msgf("unable to detect platform for asset " + candidate.asset.Name)
continue
}
assets = append(assets, &assetWithRuntime{
asset: candidate.asset,
runtime: runtime,
Expand Down
5 changes: 5 additions & 0 deletions providers/os/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,11 @@ func (s *Service) discoverRegistry(conn *connection.TarConnection) (*inventory.I
}

inventory := &inventory.Inventory{}
// we detect the platform for each asset we discover here
for _, a := range resolvedAssets {
// ignore the error. we will retry detection if we connect to the asset
_ = s.detect(a, conn)
}
inventory.AddAssets(resolvedAssets...)

return inventory, nil
Expand Down

0 comments on commit 8293e9e

Please sign in to comment.