diff --git a/providers/assets.go b/providers/assets.go index 4312e121c5..081ff2974a 100644 --- a/providers/assets.go +++ b/providers/assets.go @@ -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))