mirror of
https://github.com/netbirdio/netbird.git
synced 2026-06-06 07:59:54 +00:00
* Refactor to use a common checker for development version
* Adds commit sha to development version for cobra command only
Leave dashboard unaffected
* Adjust for "v0.31.1-dev" test case
which must be considered pre-release
* Drop synthetic "dev"/"0.50.0-dev" firewall feature-gate fixtures
These test cases encoded the loose strings.Contains(v, "dev")
semantics inherited from peerSupportedFirewallFeatures, but
NetbirdVersion() never produces those values — only the literal
"development" (and now "development-<sha>[-dirty]") ever flows
through the wire. The agent owns the semantics of an ephemeral
development build, so the tests should exercise the strings we
actually emit.
Replaced with development, development-<sha> and
development-<sha>-dirty cases that match the HasPrefix("development")
predicate introduced upstream.
* Remove unexistent tests on wire format
The sha / dirty flag are added only when the CLI asks the version.
Account versions is unaffacted and can only strictly match "development"
* Adds tests for IsDevelopmentVersion
25 lines
489 B
Go
25 lines
489 B
Go
package cmd
|
|
|
|
import (
|
|
"github.com/spf13/cobra"
|
|
|
|
"github.com/netbirdio/netbird/version"
|
|
)
|
|
|
|
var (
|
|
versionCmd = &cobra.Command{
|
|
Use: "version",
|
|
Short: "Print the NetBird's client application version",
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
cmd.SetOut(cmd.OutOrStdout())
|
|
out := version.NetbirdVersion()
|
|
if version.IsDevelopmentVersion(out) {
|
|
if commit := version.NetbirdCommit(); commit != "" {
|
|
out += "-" + commit
|
|
}
|
|
}
|
|
cmd.Println(out)
|
|
},
|
|
}
|
|
)
|