lib/build: Allow semver build in version regex (fixes #9267) (#9316)

This commit is contained in:
Peter Badida 2024-01-02 20:43:22 +01:00 committed by GitHub
parent 2abfefc18c
commit fc1c7a3c49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -36,7 +36,7 @@ var (
LongVersion string LongVersion string
Extra string Extra string
allowedVersionExp = regexp.MustCompile(`^v\d+\.\d+\.\d+(-[a-z0-9]+)*(\.\d+)*(\+\d+-g[0-9a-f]+)?(-[^\s]+)?$`) allowedVersionExp = regexp.MustCompile(`^v\d+\.\d+\.\d+(-[a-z0-9]+)*(\.\d+)*(\+\d+-g[0-9a-f]+|\+[0-9a-z]+)?(-[^\s]+)?$`)
envTags = []string{ envTags = []string{
"STGUIASSETS", "STGUIASSETS",

View File

@ -27,6 +27,11 @@ func TestAllowedVersions(t *testing.T) {
{"v0.13.0-some-weird-but-allowed-tag", true}, {"v0.13.0-some-weird-but-allowed-tag", true},
{"v0.13.0-allowed.to.do.this", true}, {"v0.13.0-allowed.to.do.this", true},
{"v0.13.0+not.allowed.to.do.this", false}, {"v0.13.0+not.allowed.to.do.this", false},
{"v1.27.0+xyz", true},
{"v1.27.0-abc.1+xyz", true},
{"v1.0.0+45", true},
{"v1.0.0-noupgrade", true},
{"v1.0.0+noupgrade", true},
} }
for i, c := range testcases { for i, c := range testcases {