mirror of
https://github.com/netbirdio/netbird.git
synced 2026-07-17 20:19:55 +00:00
Merge remote-tracking branch 'origin/main' into dmitri-event-aggregation
This commit is contained in:
@@ -13,6 +13,14 @@ import (
|
||||
// string, so it must not change without coordinating those consumers.
|
||||
const DevelopmentVersion = "development"
|
||||
|
||||
// CIVersionPrefix marks CI snapshot builds (e.g. "ci-7470fbdd"). Such builds
|
||||
// are treated as development versions by IsDevelopmentVersion.
|
||||
const CIVersionPrefix = "ci-"
|
||||
|
||||
// DevVersionPrefix marks dev snapshot builds (e.g. "dev-7470fbdd"). Such builds
|
||||
// are treated as development versions by IsDevelopmentVersion.
|
||||
const DevVersionPrefix = "dev-"
|
||||
|
||||
// will be replaced with the release version when using goreleaser
|
||||
var version = DevelopmentVersion
|
||||
|
||||
@@ -69,8 +77,11 @@ func NetbirdCommit() string {
|
||||
// comparing against the "development" literal or ad-hoc substring checks.
|
||||
//
|
||||
// Matches the bare DevelopmentVersion constant as well as any future
|
||||
// extension such as "development-<sha>" or "development-<sha>-dirty",
|
||||
// while excluding tagged prereleases like "v0.31.1-dev".
|
||||
// extension such as "development-<sha>" or "development-<sha>-dirty", and
|
||||
// CI/dev snapshot builds prefixed with "ci-" or "dev-", while excluding
|
||||
// tagged prereleases like "v0.31.1-dev".
|
||||
func IsDevelopmentVersion(v string) bool {
|
||||
return strings.HasPrefix(v, DevelopmentVersion)
|
||||
return strings.HasPrefix(v, DevelopmentVersion) ||
|
||||
strings.HasPrefix(v, CIVersionPrefix) ||
|
||||
strings.HasPrefix(v, DevVersionPrefix)
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ func TestIsDevelopmentVersion(t *testing.T) {
|
||||
{"development", true},
|
||||
{"development-0823f3ff9ab1", true},
|
||||
{"development-0823f3ff9ab1-dirty", true},
|
||||
{"ci-7470fbdd", true},
|
||||
{"dev-7470fbdd", true},
|
||||
{"0.50.0", false},
|
||||
{"v0.31.1-dev", false},
|
||||
{"1.0.0-dev", false},
|
||||
|
||||
Reference in New Issue
Block a user