quarkusio / registry.quarkus.io

Quarkus Extension Registry application
https://registry.quarkus.io
Apache License 2.0
10 stars 11 forks source link

Detecting latest Extension and Platform versions #4

Closed gastaldi closed 3 years ago

gastaldi commented 3 years ago

A common use case in the registry is knowing what is the latest version of a platform or an extension. Since versions cannot be compared as Strings (eg. 1.9.0 would be higher than 1.13.0), it would be nice to have some sort of comparison in the DB, which can be further reordered in the application if necessary.

After chatting with the team, it was decided that the best approach is to have a non-unique indexed semver column (using the pg-semver extension) containing a major.minor.micro representation of the actual platform/extension release (which the original value is kept in a separate version column). Since dealing with version qualifiers (CR, SP and productized RedHat versions) can be a nightmare, it was recommended that if more than one result is returned from the query, the ordering would happen in the application layer.

gastaldi commented 3 years ago

Since dealing with version qualifiers (CR, SP and productized RedHat versions) can be a nightmare, it was recommended that if more than one result is returned from the query, the ordering would happen in the application layer.

About ordering in the application layer, io.smallrye.common.version.VersionScheme extends Comparator so you can directly sort the result strings using VersionScheme#MAVEN

maxandersen commented 3 years ago

what does "latest" mean here? do you want latest supported version or latest published maven version ? they aren't necessarily the same.

maxandersen commented 3 years ago

like, I assume you are after just being able to sort a list of versions and wouldn't actually use the "top one" as the latest ?

gastaldi commented 3 years ago

By latest, I mean the greatest. Eg. If there are 1.9.0.Final, 1.10.Final and 1.11.0.Final platform or extension releases, the latest will be 1.11.0.Final

gastaldi commented 3 years ago

Using versioned columns formatted as %05d.%05d.%05d%s