Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Commit

Permalink
Merge pull request #405 from chanwit/show_runtime_info_in_version
Browse files Browse the repository at this point in the history
show runtime name when ignite version
  • Loading branch information
stealthybox authored Sep 6, 2019
2 parents 6e21d54 + 90af37d commit 8e6b372
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/version/cmd/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@ 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"
)

// 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
Expand All @@ -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":
Expand Down
7 changes: 7 additions & 0 deletions pkg/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import (
"fmt"
"runtime"
"strings"

"github.com/weaveworks/ignite/pkg/providers"
igniteruntime "github.com/weaveworks/ignite/pkg/runtime"
)

var (
Expand Down Expand Up @@ -67,3 +70,7 @@ func GetFirecracker() Info {
GitVersion: firecrackerVersion,
}
}

func GetCurrentRuntime() igniteruntime.Name {
return providers.RuntimeName
}

0 comments on commit 8e6b372

Please sign in to comment.