mirror of
https://github.com/YuzuZensai/netbird-kubernetes-operator.git
synced 2026-09-13 18:59:09 +00:00
Add build version to NetBird client user agent. (#248)
This also fix the runtime import aliases to avoid conflicts with stdlib runtime.
This commit is contained in:
@@ -2,6 +2,36 @@
|
||||
|
||||
package version
|
||||
|
||||
import (
|
||||
"runtime/debug"
|
||||
)
|
||||
|
||||
func ClientImage() string {
|
||||
return "ghcr.io/netbirdio/netbird:0.70.4@sha256:3a28b9f7f32875c6a35f952ca7e9cb688b1e610365365ff55f6e790da3950f55"
|
||||
}
|
||||
|
||||
func BuildVersion() string {
|
||||
bi, ok := debug.ReadBuildInfo()
|
||||
if !ok {
|
||||
return "unknown"
|
||||
}
|
||||
|
||||
modified := true
|
||||
for _, s := range bi.Settings {
|
||||
if s.Key == "vcs.modified" {
|
||||
if s.Value == "false" {
|
||||
modified = false
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
develVersion := "devel"
|
||||
if modified {
|
||||
return develVersion
|
||||
}
|
||||
if bi.Main.Version == "" {
|
||||
return develVersion
|
||||
}
|
||||
return bi.Main.Version
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user