Skip to content

Commit

Permalink
🧹 Apply root-level asset labels to inventory assets.
Browse files Browse the repository at this point in the history
  • Loading branch information
preslavgerchev committed Sep 29, 2023
1 parent 799697f commit 8aea623
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion providers/assets.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,17 @@ func ProcessAssetCandidates(runtime *Runtime, connectRes *pp.ConnectRes, upstrea
return []*inventory.Asset{connectRes.Asset}, nil
} else {
logger.DebugDumpJSON("inventory-resolved", connectRes.Inventory)
assetCandidates = connectRes.Inventory.Spec.Assets
// We want to apply all root asset labels to the inventory assets. We could also do this
// per provider, but we'd have to apply the same logic in all providers.
for _, a := range connectRes.Inventory.Spec.Assets {
for k, v := range connectRes.Asset.Labels {
if a.Labels == nil {
a.Labels = map[string]string{}
}
a.Labels[k] = v
}
assetCandidates = append(assetCandidates, a)
}
}
log.Debug().Msgf("resolved %d assets", len(assetCandidates))

Expand Down

0 comments on commit 8aea623

Please sign in to comment.