sensu-go
sensu-go copied to clipboard
Make asset build matching order deterministic
Currently when asset build filter rules overlap in an asset definition, allowing for a multiple builds to be used on a target agent platform, its undetermined which matching asset will be used.
The nondeterministic nature of which matching asset will be downloaded makes overlapping assets situations difficult to test,confirm and resolve.
If there was a way to enforce ordering of asset builds, so that each build, this would allow for deterministic behavior in the case of overlapping filter rules.
Possible Implementation
explicit match order using a new priority attribute.
Use case
Existing asset has a build for debian 7 with filter "debian platform release >= 7" Introduce new build for debian 8 with filter "debian platform release >= 8" Set priority higher for debian 8 build relative to debian 7 build Use asset on agent running on debian 9, result is deterministic use of debian 8 build.
Alternative backwards compatible implementation...
Sort asset build by sha512 alphanumeric value when iterating over builds for matching build selection.
This would provide deterministic build selection behavior for testing/troubleshooting without the need for asset developer to express an opinion concerning ordering of builds.
Sorting sha512 values should be a patch level change, backwards compatible with existing asset definitions.
Dupe of / related to https://github.com/sensu/sensu-go/issues/3655.