mirror of https://github.com/kubernetes/kops.git
parent
2cdd4a5e16
commit
d77d6f4859
6
Makefile
6
Makefile
|
|
@ -3,8 +3,12 @@ all: gocode
|
|||
DOCKER_REGISTRY=gcr.io/must-override/
|
||||
S3_BUCKET=s3://must-override/
|
||||
|
||||
ifndef VERSION
|
||||
VERSION := git-$(shell git rev-parse --short HEAD)
|
||||
endif
|
||||
|
||||
gocode:
|
||||
GO15VENDOREXPERIMENT=1 go install k8s.io/kops/cmd/...
|
||||
GO15VENDOREXPERIMENT=1 go install -ldflags "-X main.BuildVersion=${VERSION}" k8s.io/kops/cmd/...
|
||||
ln -sfn ${GOPATH}/src/k8s.io/kops/upup/models/ ${GOPATH}/bin/models
|
||||
|
||||
codegen:
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/golang/glog"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
var (
|
||||
// value overwritten during build. This can be used to resolve issues.
|
||||
BuildVersion = "0.1"
|
||||
)
|
||||
|
||||
type VersionCmd struct {
|
||||
cobraCommand *cobra.Command
|
||||
}
|
||||
|
||||
var versionCmd = VersionCmd{
|
||||
cobraCommand: &cobra.Command{
|
||||
Use: "version",
|
||||
Short: "Print the client version information",
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
cmd := versionCmd.cobraCommand
|
||||
rootCommand.cobraCommand.AddCommand(cmd)
|
||||
|
||||
cmd.Run = func(cmd *cobra.Command, args []string) {
|
||||
err := versionCmd.Run()
|
||||
if err != nil {
|
||||
glog.Exitf("%v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (c *VersionCmd) Run() error {
|
||||
fmt.Printf("Version %s\n", BuildVersion)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue