forked from TrueCloudLab/frostfs-node
[#1587] Do not print build time in `version`
This makes our build more reproducible. Also print `Component` and `GoVersion`. Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>support/v0.30
parent
b3272e7cf1
commit
5569ff82ef
2
Makefile
2
Makefile
|
@ -3,7 +3,6 @@ SHELL = bash
|
||||||
|
|
||||||
REPO ?= $(shell go list -m)
|
REPO ?= $(shell go list -m)
|
||||||
VERSION ?= $(shell git describe --tags --dirty --always 2>/dev/null || cat VERSION 2>/dev/null || echo "develop")
|
VERSION ?= $(shell git describe --tags --dirty --always 2>/dev/null || cat VERSION 2>/dev/null || echo "develop")
|
||||||
BUILD ?= $(shell date -u --iso=seconds)
|
|
||||||
DEBUG ?= false
|
DEBUG ?= false
|
||||||
|
|
||||||
HUB_IMAGE ?= nspccdev/neofs
|
HUB_IMAGE ?= nspccdev/neofs
|
||||||
|
@ -36,7 +35,6 @@ $(BINS): $(DIRS) dep
|
||||||
CGO_ENABLED=0 \
|
CGO_ENABLED=0 \
|
||||||
go build -v -trimpath \
|
go build -v -trimpath \
|
||||||
-ldflags "-X $(REPO)/misc.Version=$(VERSION) \
|
-ldflags "-X $(REPO)/misc.Version=$(VERSION) \
|
||||||
-X $(REPO)/misc.Build=$(BUILD) \
|
|
||||||
-X $(REPO)/misc.Debug=$(DEBUG)" \
|
-X $(REPO)/misc.Debug=$(DEBUG)" \
|
||||||
-o $@ ./cmd/$(notdir $@)
|
-o $@ ./cmd/$(notdir $@)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package modules
|
package modules
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/nspcc-dev/neofs-node/cmd/neofs-adm/internal/modules/config"
|
"github.com/nspcc-dev/neofs-node/cmd/neofs-adm/internal/modules/config"
|
||||||
|
@ -53,11 +52,7 @@ func Execute() error {
|
||||||
func entryPoint(cmd *cobra.Command, args []string) error {
|
func entryPoint(cmd *cobra.Command, args []string) error {
|
||||||
printVersion, err := cmd.Flags().GetBool("version")
|
printVersion, err := cmd.Flags().GetBool("version")
|
||||||
if err == nil && printVersion {
|
if err == nil && printVersion {
|
||||||
fmt.Printf("Version: %s \nBuild: %s \nDebug: %s\n",
|
cmd.Print(misc.BuildInfo("NeoFS Adm"))
|
||||||
misc.Version,
|
|
||||||
misc.Build,
|
|
||||||
misc.Debug,
|
|
||||||
)
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,12 +87,7 @@ func init() {
|
||||||
func entryPoint(cmd *cobra.Command, _ []string) {
|
func entryPoint(cmd *cobra.Command, _ []string) {
|
||||||
printVersion, _ := cmd.Flags().GetBool("version")
|
printVersion, _ := cmd.Flags().GetBool("version")
|
||||||
if printVersion {
|
if printVersion {
|
||||||
cmd.Printf(
|
cmd.Print(misc.BuildInfo("NeoFS CLI"))
|
||||||
"Version: %s \nBuild: %s \nDebug: %s\n",
|
|
||||||
misc.Version,
|
|
||||||
misc.Build,
|
|
||||||
misc.Debug,
|
|
||||||
)
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,12 +39,7 @@ func main() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
if *versionFlag {
|
if *versionFlag {
|
||||||
fmt.Printf(
|
fmt.Print(misc.BuildInfo("NeoFS Inner Ring node"))
|
||||||
"Version: %s \nBuild: %s \nDebug: %s\n",
|
|
||||||
misc.Version,
|
|
||||||
misc.Build,
|
|
||||||
misc.Debug,
|
|
||||||
)
|
|
||||||
|
|
||||||
os.Exit(SuccessReturnCode)
|
os.Exit(SuccessReturnCode)
|
||||||
}
|
}
|
||||||
|
@ -85,7 +80,6 @@ func main() {
|
||||||
exitErr(err)
|
exitErr(err)
|
||||||
|
|
||||||
log.Info("application started",
|
log.Info("application started",
|
||||||
zap.String("build_time", misc.Build),
|
|
||||||
zap.String("version", misc.Version),
|
zap.String("version", misc.Version),
|
||||||
zap.String("debug", misc.Debug),
|
zap.String("debug", misc.Debug),
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/nspcc-dev/neofs-node/cmd/neofs-lens/internal/commands/inspect"
|
"github.com/nspcc-dev/neofs-node/cmd/neofs-lens/internal/commands/inspect"
|
||||||
|
@ -22,11 +21,8 @@ var command = &cobra.Command{
|
||||||
func entryPoint(cmd *cobra.Command, _ []string) error {
|
func entryPoint(cmd *cobra.Command, _ []string) error {
|
||||||
printVersion, err := cmd.Flags().GetBool("version")
|
printVersion, err := cmd.Flags().GetBool("version")
|
||||||
if err == nil && printVersion {
|
if err == nil && printVersion {
|
||||||
fmt.Printf("Version: %s \nBuild: %s \nDebug: %s\n",
|
cmd.Print(misc.BuildInfo("NeoFS Lens"))
|
||||||
misc.Version,
|
|
||||||
misc.Build,
|
|
||||||
misc.Debug,
|
|
||||||
)
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,12 +39,7 @@ func main() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
if *versionFlag {
|
if *versionFlag {
|
||||||
fmt.Printf(
|
fmt.Print(misc.BuildInfo("NeoFS Storage node"))
|
||||||
"Version: %s \nBuild: %s \nDebug: %s\n",
|
|
||||||
misc.Version,
|
|
||||||
misc.Build,
|
|
||||||
misc.Debug,
|
|
||||||
)
|
|
||||||
|
|
||||||
os.Exit(SuccessReturnCode)
|
os.Exit(SuccessReturnCode)
|
||||||
}
|
}
|
||||||
|
@ -115,7 +110,6 @@ func bootUp(c *cfg) {
|
||||||
|
|
||||||
func wait(c *cfg) {
|
func wait(c *cfg) {
|
||||||
c.log.Info("application started",
|
c.log.Info("application started",
|
||||||
zap.String("build_time", misc.Build),
|
|
||||||
zap.String("version", misc.Version),
|
zap.String("version", misc.Version),
|
||||||
zap.String("debug", misc.Debug),
|
zap.String("debug", misc.Debug),
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,13 +1,25 @@
|
||||||
package misc
|
package misc
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"runtime"
|
||||||
|
)
|
||||||
|
|
||||||
// These variables are changed in compile time.
|
// These variables are changed in compile time.
|
||||||
var (
|
var (
|
||||||
// Build is an application build time.
|
|
||||||
Build = "now"
|
|
||||||
|
|
||||||
// Version is an application version.
|
// Version is an application version.
|
||||||
Version = "dev"
|
Version = "dev"
|
||||||
|
|
||||||
// Debug is an application debug mode flag.
|
// Debug is an application debug mode flag.
|
||||||
Debug = "false"
|
Debug = "false"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// BuildInfo returns human-readable information about this binary.
|
||||||
|
func BuildInfo(component string) string {
|
||||||
|
return fmt.Sprintf("%s\nVersion: %s \nGoVersion: %s\nDebug: %s\n",
|
||||||
|
component,
|
||||||
|
Version,
|
||||||
|
runtime.Version(),
|
||||||
|
Debug,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue