nix: make status-go matching regex more lax

We had an issue where the `1.7.0` release was using the `v0.62.3.hotfix.3`
version of `status-go` which didn't match the regex we use to verify
if the specified version is a valid version according to [Semantic Versioning](https://semver.org/).

You can check the current regex here: https://regex101.com/r/OeTQCv/3

I also added a trace message to show when we mark a build as `develop`.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2020-10-23 17:41:00 +02:00
parent 663f5f41a0
commit 973bdb61b3
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
1 changed files with 3 additions and 3 deletions

View File

@ -48,14 +48,14 @@ let
# paths don't like slashes in them # paths don't like slashes in them
dropSlashes = builtins.replaceStrings [ "/" ] [ "_" ]; dropSlashes = builtins.replaceStrings [ "/" ] [ "_" ];
# if version doesn't match this it's probably a commit # if version doesn't match this it's probably a commit, it's lax semver
versionRegex = "^v?[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+(-[[:alnum:].]+)?$"; versionRegex = "^v?[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+[[:alnum:]_.-]*$";
sanitizeVersion = version: sanitizeVersion = version:
if (builtins.match versionRegex version) != null if (builtins.match versionRegex version) != null
# Geth forces a 'v' prefix for all versions # Geth forces a 'v' prefix for all versions
then lib.removePrefix "v" (dropSlashes version) then lib.removePrefix "v" (dropSlashes version)
# reduce metrics cardinality in Prometheus # reduce metrics cardinality in Prometheus
else "develop"; else lib.traceValFn (v: "WARNING: Marking build version as 'develop'!") "develop";
in { in {
inherit sanitizeVersion inherit sanitizeVersion