Commit 15b428d4 authored by Michelle Noorali's avatar Michelle Noorali

feat(*): add version to release

laying ground work for #690
parent e91bbcef
...@@ -44,4 +44,8 @@ message Release { ...@@ -44,4 +44,8 @@ message Release {
// Hooks are all of the hooks declared for this release. // Hooks are all of the hooks declared for this release.
repeated hapi.release.Hook hooks = 6; repeated hapi.release.Hook hooks = 6;
// Version is an int32 which represents the version of the release.
int32 version = 7;
} }
...@@ -92,8 +92,9 @@ func (g *getCmd) run() error { ...@@ -92,8 +92,9 @@ func (g *getCmd) run() error {
return err return err
} }
fmt.Fprintf(g.out, "CHART: %s-%s\n", res.Release.Chart.Metadata.Name, res.Release.Chart.Metadata.Version) fmt.Fprintf(g.out, "VERSION: %v\n", res.Release.Version)
fmt.Fprintf(g.out, "RELEASED: %s\n", timeconv.Format(res.Release.Info.LastDeployed, time.ANSIC)) fmt.Fprintf(g.out, "RELEASED: %s\n", timeconv.Format(res.Release.Info.LastDeployed, time.ANSIC))
fmt.Fprintf(g.out, "CHART: %s-%s\n", res.Release.Chart.Metadata.Name, res.Release.Chart.Metadata.Version)
fmt.Fprintln(g.out, "USER-SUPPLIED VALUES:") fmt.Fprintln(g.out, "USER-SUPPLIED VALUES:")
fmt.Fprintln(g.out, res.Release.Config.Raw) fmt.Fprintln(g.out, res.Release.Config.Raw)
fmt.Fprintln(g.out, "COMPUTED VALUES:") fmt.Fprintln(g.out, "COMPUTED VALUES:")
......
...@@ -36,7 +36,7 @@ func TestGetCmd(t *testing.T) { ...@@ -36,7 +36,7 @@ func TestGetCmd(t *testing.T) {
name: "with a release", name: "with a release",
resp: releaseMock("thomas-guide"), resp: releaseMock("thomas-guide"),
args: []string{"thomas-guide"}, args: []string{"thomas-guide"},
expected: "CHART: foo-0.1.0-beta.1\nRELEASED: (.*)\nUSER-SUPPLIED VALUES:\nname: \"value\"\nCOMPUTED VALUES:\nname: value\n\nMANIFEST:", expected: "VERSION: 1\nRELEASED: (.*)\nCHART: foo-0.1.0-beta.1\nUSER-SUPPLIED VALUES:\nname: \"value\"\nCOMPUTED VALUES:\nname: value\n\nMANIFEST:",
}, },
{ {
name: "requires release name arg", name: "requires release name arg",
......
...@@ -43,7 +43,8 @@ func releaseMock(name string) *release.Release { ...@@ -43,7 +43,8 @@ func releaseMock(name string) *release.Release {
{Name: "foo.tpl", Data: []byte("Hello")}, {Name: "foo.tpl", Data: []byte("Hello")},
}, },
}, },
Config: &chart.Config{Raw: `name: "value"`}, Config: &chart.Config{Raw: `name: "value"`},
Version: 1,
} }
} }
......
...@@ -141,12 +141,13 @@ func (l *listCmd) run() error { ...@@ -141,12 +141,13 @@ func (l *listCmd) run() error {
func formatList(rels []*release.Release) string { func formatList(rels []*release.Release) string {
table := uitable.New() table := uitable.New()
table.MaxColWidth = 30 table.MaxColWidth = 30
table.AddRow("NAME", "UPDATED", "STATUS", "CHART") table.AddRow("NAME", "VERSION", "UPDATED", "STATUS", "CHART")
for _, r := range rels { for _, r := range rels {
c := fmt.Sprintf("%s-%s", r.Chart.Metadata.Name, r.Chart.Metadata.Version) c := fmt.Sprintf("%s-%s", r.Chart.Metadata.Name, r.Chart.Metadata.Version)
t := timeconv.String(r.Info.LastDeployed) t := timeconv.String(r.Info.LastDeployed)
s := r.Info.Status.Code.String() s := r.Info.Status.Code.String()
table.AddRow(r.Name, t, s, c) v := r.Version
table.AddRow(r.Name, v, t, s, c)
} }
return table.String() return table.String()
} }
...@@ -52,7 +52,7 @@ func TestListRun(t *testing.T) { ...@@ -52,7 +52,7 @@ func TestListRun(t *testing.T) {
}, },
long: true, long: true,
}, },
expected: "NAME \tUPDATED \tSTATUS \tCHART \natlas\t(.*)\tDEPLOYED\tfoo-0.1.0-beta.1", expected: "NAME \tVERSION\tUPDATED \tSTATUS \tCHART \natlas\t1 \t(.*)\tDEPLOYED\tfoo-0.1.0-beta.1\n",
}, },
} }
...@@ -93,7 +93,7 @@ func TestListCmd(t *testing.T) { ...@@ -93,7 +93,7 @@ func TestListCmd(t *testing.T) {
resp: []*release.Release{ resp: []*release.Release{
releaseMock("atlas"), releaseMock("atlas"),
}, },
expected: "NAME \tUPDATED \tSTATUS \tCHART \natlas\t(.*)\tDEPLOYED\tfoo-0.1.0-beta.1", expected: "NAME \tVERSION\tUPDATED \tSTATUS \tCHART \natlas\t1 \t(.*)\tDEPLOYED\tfoo-0.1.0-beta.1\n",
}, },
} }
......
...@@ -277,6 +277,7 @@ func (s *releaseServer) prepareRelease(req *services.InstallReleaseRequest) (*re ...@@ -277,6 +277,7 @@ func (s *releaseServer) prepareRelease(req *services.InstallReleaseRequest) (*re
}, },
Manifest: b.String(), Manifest: b.String(),
Hooks: hooks, Hooks: hooks,
Version: 1,
} }
return rel, nil return rel, nil
} }
......
...@@ -31,6 +31,8 @@ type Release struct { ...@@ -31,6 +31,8 @@ type Release struct {
Manifest string `protobuf:"bytes,5,opt,name=manifest" json:"manifest,omitempty"` Manifest string `protobuf:"bytes,5,opt,name=manifest" json:"manifest,omitempty"`
// Hooks are all of the hooks declared for this release. // Hooks are all of the hooks declared for this release.
Hooks []*Hook `protobuf:"bytes,6,rep,name=hooks" json:"hooks,omitempty"` Hooks []*Hook `protobuf:"bytes,6,rep,name=hooks" json:"hooks,omitempty"`
// Version is an int32 which represents the version of the release.
Version int32 `protobuf:"varint,7,opt,name=version" json:"version,omitempty"`
} }
func (m *Release) Reset() { *m = Release{} } func (m *Release) Reset() { *m = Release{} }
...@@ -71,19 +73,20 @@ func init() { ...@@ -71,19 +73,20 @@ func init() {
} }
var fileDescriptor2 = []byte{ var fileDescriptor2 = []byte{
// 224 bytes of a gzipped FileDescriptorProto // 239 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x64, 0x90, 0x3f, 0x4f, 0x85, 0x30, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x64, 0x90, 0x3f, 0x4f, 0x03, 0x31,
0x14, 0xc5, 0x83, 0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0xd9, 0x73, 0x44, 0x92, 0x05, 0x48, 0xd0, 0x7d, 0x69, 0x1f, 0x8c,
0x47, 0xbf, 0xfc, 0x07, 0x00, 0x00, 0xff, 0xff, 0x96, 0x35, 0x9e, 0xef, 0x83, 0x01, 0x00, 0x00, 0xb3, 0xd4, 0x45, 0x93, 0x46, 0x1e, 0xda, 0xc7, 0xe5, 0x6b, 0x57, 0x1e, 0xbc, 0xb5, 0x79, 0x1d,
0x0f, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x49, 0x8d, 0x14, 0x1a, 0x9d, 0x01, 0x00, 0x00,
} }
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