From 90af37d5b701d5808036ccc7e1c257108e4fcdf0 Mon Sep 17 00:00:00 2001 From: Chanwit Kaewkasi Date: Fri, 6 Sep 2019 19:52:37 +0700 Subject: [PATCH] show runtime name when ignite version Signed-off-by: Chanwit Kaewkasi --- pkg/version/cmd/command.go | 8 ++++++-- pkg/version/version.go | 7 +++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/pkg/version/cmd/command.go b/pkg/version/cmd/command.go index 98462b0ae..451cac3ae 100644 --- a/pkg/version/cmd/command.go +++ b/pkg/version/cmd/command.go @@ -6,6 +6,7 @@ import ( "io" "github.com/spf13/cobra" + igniteruntime "github.com/weaveworks/ignite/pkg/runtime" "github.com/weaveworks/ignite/pkg/util" "github.com/weaveworks/ignite/pkg/version" "sigs.k8s.io/yaml" @@ -13,8 +14,9 @@ import ( // versionData provides the version information of ignite. type versionData struct { - Ignite version.Info `json:"igniteVersion"` - Firecracker version.Info `json:"firecrackerVersion"` + Ignite version.Info `json:"igniteVersion"` + Firecracker version.Info `json:"firecrackerVersion"` + Runtime igniteruntime.Name `json:"runtime"` } // NewCmdVersion provides the version information of ignite @@ -39,12 +41,14 @@ func RunVersion(out io.Writer, output string) error { v := versionData{ Ignite: version.GetIgnite(), Firecracker: version.GetFirecracker(), + Runtime: version.GetCurrentRuntime(), } switch output { case "": fmt.Fprintf(out, "Ignite version: %#v\n", v.Ignite) fmt.Fprintf(out, "Firecracker version: %s\n", v.Firecracker.String()) + fmt.Fprintf(out, "Runtime: %v\n", v.Runtime) case "short": fmt.Fprintf(out, "%s\n", v.Ignite.GitVersion) case "yaml": diff --git a/pkg/version/version.go b/pkg/version/version.go index 18b6e03cd..25aad01a2 100644 --- a/pkg/version/version.go +++ b/pkg/version/version.go @@ -4,6 +4,9 @@ import ( "fmt" "runtime" "strings" + + "github.com/weaveworks/ignite/pkg/providers" + igniteruntime "github.com/weaveworks/ignite/pkg/runtime" ) var ( @@ -67,3 +70,7 @@ func GetFirecracker() Info { GitVersion: firecrackerVersion, } } + +func GetCurrentRuntime() igniteruntime.Name { + return providers.RuntimeName +}