sensu-go
sensu-go copied to clipboard
Asset builds with highest counted elements of build filter takes precedence
Feature Suggestion
When multiple builds have passing filters use the build with the highest (counted elements) matched filters.
Possible Implementation
N/A - I haven't reviewed the current code.
Context
For assets with multiple builds, only the first build which matches will be downloaded and installed.
Based on this from Asset Documentation, it means that if you have:
filters: ["entity.system.os == 'linux'", "entity.system.arch == 'amd64'"]
vs.
filters: ["entity.system.os == 'linux'", "entity.system.arch == 'amd64'", "some.label.zone == 'foo'"]
Present Implementation would use the build information from the first build
slice.
Feature: Because the 2nd slice has 3 total elements, it takes precedence.
Edge Case: same present condition, if 2 slices of the same size exists, use first.
Interesting idea, thanks!
We should audit how filtering behaves currently, @amdprophet believes it's the first match. If that's the case, implementing this could be a breaking change for some use cases. Potentially a good candidate for 6.0.0, but needs more investigation first.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I removed the wontfix
label, but this might have to sit in the backlog until the next major release (2021) as it would be a breaking change, as commented above.
That is fine. I have worked around the issue in Ruby.