mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
Fix version printing on startup
This commit is contained in:
parent
56fae079e5
commit
01b3bb315e
@ -9,6 +9,7 @@ import (
|
||||
"github.com/rancher/k3s/pkg/cli/cmds"
|
||||
"github.com/rancher/norman/pkg/resolvehome"
|
||||
"github.com/rancher/norman/signal"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
@ -25,6 +26,8 @@ func Run(ctx *cli.Context) error {
|
||||
return fmt.Errorf("--server is required")
|
||||
}
|
||||
|
||||
logrus.Infof("Starting k3s agent %s", ctx.App.Version)
|
||||
|
||||
dataDir, err := resolvehome.Resolve(cmds.AgentConfig.DataDir)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -35,5 +38,6 @@ func Run(ctx *cli.Context) error {
|
||||
cfg.DataDir = dataDir
|
||||
|
||||
contextCtx := signal.SigTermCancelContext(context.Background())
|
||||
|
||||
return agent.Run(contextCtx, cfg)
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ func NewApp() *cli.App {
|
||||
app := cli.NewApp()
|
||||
app.Name = appName
|
||||
app.Usage = "Kubernetes, but small and simple"
|
||||
app.Version = version.Version
|
||||
app.Version = fmt.Sprintf("%s (%s)", version.Version, version.GitCommit)
|
||||
cli.VersionPrinter = func(c *cli.Context) {
|
||||
fmt.Printf("%s version %s\n", app.Name, app.Version)
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ source $(dirname $0)/version.sh
|
||||
|
||||
cd $(dirname $0)/..
|
||||
|
||||
LDFLAGS="-X github.com/rancher/k3s/version.Version=$VERSION -w -s"
|
||||
LDFLAGS="-X github.com/rancher/k3s/pkg/version.Version=$VERSION -X github.com/rancher/k3s/pkg/version.GitCommit=${COMMIT:0:8} -w -s"
|
||||
STATIC="-extldflags '-static'"
|
||||
STATIC_SQLITE="-extldflags '-static -lm -ldl -lz -lpthread'"
|
||||
TAGS="ctrd apparmor seccomp no_btrfs netgo osusergo"
|
||||
|
Loading…
Reference in New Issue
Block a user