Skip to content

Commit

Permalink
apply runtimeenv labels for discovered assets
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Milchev <[email protected]>
  • Loading branch information
imilchev committed Oct 3, 2023
1 parent b96ab2f commit daf9f22
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions policy/scan/local_scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,21 @@ func (s *LocalScanner) distributeJob(job *Job, ctx context.Context, upstream *up
return nil, false, nil
}

runtimeEnv := execruntime.Detect()
var runtimeLabels map[string]string
if runtimeEnv != nil {
runtimeLabels = runtimeEnv.Labels()
}

justAssets := []*inventory.Asset{}
for _, asset := range assets {
asset.asset.KindString = asset.asset.GetPlatform().Kind
for k, v := range runtimeLabels {
if asset.asset.Labels == nil {
asset.asset.Labels = map[string]string{}
}
asset.asset.Labels[k] = v
}
justAssets = append(justAssets, asset.asset)
}

Expand Down

0 comments on commit daf9f22

Please sign in to comment.