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

Make asset build matching order deterministic

Open jspaleta opened this issue 3 years ago • 2 comments

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.

jspaleta avatar Oct 26 '21 20:10 jspaleta

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.

jspaleta avatar Oct 26 '21 21:10 jspaleta

Dupe of / related to https://github.com/sensu/sensu-go/issues/3655.

amdprophet avatar Nov 04 '21 19:11 amdprophet