Commit 0209ac32 authored by Derek Bassett's avatar Derek Bassett

Add App Version to the helm ls command.

parent 506ed05b
...@@ -237,7 +237,7 @@ func formatList(rels []*release.Release, colWidth uint) string { ...@@ -237,7 +237,7 @@ func formatList(rels []*release.Release, colWidth uint) string {
table := uitable.New() table := uitable.New()
table.MaxColWidth = colWidth table.MaxColWidth = colWidth
table.AddRow("NAME", "REVISION", "UPDATED", "STATUS", "CHART", "NAMESPACE") table.AddRow("NAME", "REVISION", "UPDATED", "STATUS", "CHART", "APP VERSION", "NAMESPACE")
for _, r := range rels { for _, r := range rels {
md := r.GetChart().GetMetadata() md := r.GetChart().GetMetadata()
c := fmt.Sprintf("%s-%s", md.GetName(), md.GetVersion()) c := fmt.Sprintf("%s-%s", md.GetName(), md.GetVersion())
...@@ -247,8 +247,9 @@ func formatList(rels []*release.Release, colWidth uint) string { ...@@ -247,8 +247,9 @@ func formatList(rels []*release.Release, colWidth uint) string {
} }
s := r.GetInfo().GetStatus().GetCode().String() s := r.GetInfo().GetStatus().GetCode().String()
v := r.GetVersion() v := r.GetVersion()
a := md.GetAppVersion()
n := r.GetNamespace() n := r.GetNamespace()
table.AddRow(r.GetName(), v, t, s, c, n) table.AddRow(r.GetName(), v, t, s, c, a, n)
} }
return table.String() return table.String()
} }
...@@ -22,11 +22,29 @@ import ( ...@@ -22,11 +22,29 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
"io/ioutil"
"k8s.io/helm/pkg/chartutil"
"k8s.io/helm/pkg/helm" "k8s.io/helm/pkg/helm"
"k8s.io/helm/pkg/proto/hapi/chart"
"k8s.io/helm/pkg/proto/hapi/release" "k8s.io/helm/pkg/proto/hapi/release"
"os"
) )
func TestListCmd(t *testing.T) { func TestListCmd(t *testing.T) {
tmpChart, _ := ioutil.TempDir("testdata", "tmp")
defer os.RemoveAll(tmpChart)
cfile := &chart.Metadata{
Name: "foo",
Description: "A Helm chart for Kubernetes",
Version: "0.1.0-beta.1",
AppVersion: "2.X.A",
}
chartPath, err := chartutil.Create(cfile, tmpChart)
if err != nil {
t.Errorf("Error creating chart for list: %v", err)
}
ch, _ := chartutil.Load(chartPath)
tests := []releaseCase{ tests := []releaseCase{
{ {
name: "with a release", name: "with a release",
...@@ -40,7 +58,14 @@ func TestListCmd(t *testing.T) { ...@@ -40,7 +58,14 @@ func TestListCmd(t *testing.T) {
rels: []*release.Release{ rels: []*release.Release{
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas"}), helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas"}),
}, },
expected: "NAME \tREVISION\tUPDATED \tSTATUS \tCHART \tNAMESPACE\natlas\t1 \t(.*)\tDEPLOYED\tfoo-0.1.0-beta.1\tdefault \n", expected: "NAME \tREVISION\tUPDATED \tSTATUS \tCHART \tAPP VERSION\tNAMESPACE\natlas\t1 \t(.*)\tDEPLOYED\tfoo-0.1.0-beta.1\t \tdefault \n",
},
{
name: "list with appVersion",
rels: []*release.Release{
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas", Chart: ch}),
},
expected: "NAME \tREVISION\tUPDATED \tSTATUS \tCHART \tAPP VERSION\tNAMESPACE\natlas\t1 \t(.*)\tDEPLOYED\tfoo-0.1.0-beta.1\t2.X.A \tdefault \n",
}, },
{ {
name: "list, one deployed, one failed", name: "list, one deployed, one failed",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment