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

show runtime name when ignite version #405

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}