enhance: Unify milvus version def (#40227)

Related to #40216

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
congqixia 2025-02-27 14:15:57 +08:00 committed by GitHub
parent a0763b3c02
commit 35f188b329
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View File

@ -10,6 +10,7 @@ import (
"go.uber.org/zap"
"github.com/milvus-io/milvus/pkg/v2/common"
"github.com/milvus-io/milvus/pkg/v2/log"
"github.com/milvus-io/milvus/pkg/v2/metrics"
"github.com/milvus-io/milvus/pkg/v2/util/hardware"
@ -55,12 +56,12 @@ func (c *run) printBanner(w io.Writer) {
fmt.Fprintln(w, " /_/ /_/___/____/___/\\____/___/ ")
fmt.Fprintln(w)
fmt.Fprintln(w, "Welcome to Milvus!")
fmt.Fprintln(w, "Version: "+BuildTags)
fmt.Fprintln(w, "Version: "+common.Version.String())
fmt.Fprintln(w, "Built: "+BuildTime)
fmt.Fprintln(w, "GitCommit: "+GitCommit)
fmt.Fprintln(w, "GoVersion: "+GoVersion)
fmt.Fprintln(w)
metrics.BuildInfo.WithLabelValues(BuildTags, BuildTime, GitCommit).Set(1)
metrics.BuildInfo.WithLabelValues(common.Version.String(), BuildTime, GitCommit).Set(1)
}
func (c *run) printHardwareInfo(w io.Writer) {
@ -82,7 +83,7 @@ func (c *run) injectVariablesToEnv() {
zap.Error(err))
}
err = os.Setenv(metricsinfo.GitBuildTagsEnvKey, BuildTags)
err = os.Setenv(metricsinfo.GitBuildTagsEnvKey, common.Version.String())
if err != nil {
log.Warn(fmt.Sprintf("failed to inject %s to environment variable", metricsinfo.GitBuildTagsEnvKey),
zap.Error(err))

View File

@ -6,5 +6,5 @@ import semver "github.com/blang/semver/v4"
var Version semver.Version
func init() {
Version = semver.MustParse("2.4.2")
Version = semver.MustParse("2.6.0-dev")
}