sensu-go icon indicating copy to clipboard operation
sensu-go copied to clipboard

Asset builds with highest counted elements of build filter takes precedence

Open tarcinil opened this issue 4 years ago • 5 comments

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.

tarcinil avatar Mar 30 '20 19:03 tarcinil

Interesting idea, thanks!

echlebek avatar Mar 30 '20 23:03 echlebek

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.

nikkictl avatar Mar 31 '20 17:03 nikkictl

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.

stale[bot] avatar Oct 02 '20 05:10 stale[bot]

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.

calebhailey avatar Oct 05 '20 16:10 calebhailey

That is fine. I have worked around the issue in Ruby.

tarcinil avatar Oct 05 '20 18:10 tarcinil