Support generic entity instance in selectors
This in turn will add support to the release entity in selectors.
With the current implementation, if a selector is added to the release entity, for example:
selection:
- entity: release
selector: entity.name == 'test-org/public-repo/v8'
Then it fails with the message
No converter available
because the selector logic is written per entity type and there is no support for releases, see https://github.com/mindersec/minder/blob/58972c8c7368b02c190c2317080277c629ad1fc7/internal/providers/selectors/selector_entity.go#L98-L108
Since we are moving towards having a more generic entity type, using the EntityInstance type, we should also make the selector logic more generic.
Copying conversation from #5379
Can we have a general way for entities to use selectors via properties? That way we wouldn't have these entity specific pieces of code.
Hmm -- the way I see it is:
- Entities need to be able to expose a set of properties (e.g. for a GitHub release (which is associated with a repo), this would include both release-specific properties (like the tag) as well as repo properties (such as whether the repo is public).
- Selectors need to be able to operate over properties like
repository.is_private = trueand have that apply to not just repositories, but entities which are linked to a repository, like PRs and releases.Does that make sense? If so, I'd like it to be required (e.g. compile error if not implemented) for entities to implement enough of "expose properties" to support selectors. I think that could end up with a generic "entity" and properties extracted from it, or a few other routes.
Entities already all should have Properties, and the protobuf provides a GetProperties function. So... we should already be able to generalize