From 15b428d450cc7a63d5ecb338b211182de9db7fb2 Mon Sep 17 00:00:00 2001 From: Michelle Noorali Date: Wed, 6 Jul 2016 17:01:34 -0600 Subject: [PATCH] feat(*): add version to release laying ground work for #690 --- _proto/hapi/release/release.proto | 4 ++++ cmd/helm/get.go | 3 ++- cmd/helm/get_test.go | 2 +- cmd/helm/helm_test.go | 3 ++- cmd/helm/list.go | 5 +++-- cmd/helm/list_test.go | 4 ++-- cmd/tiller/release_server.go | 1 + pkg/proto/hapi/release/release.pb.go | 33 +++++++++++++++------------- 8 files changed, 33 insertions(+), 22 deletions(-) diff --git a/_proto/hapi/release/release.proto b/_proto/hapi/release/release.proto index 890a4ed72..a13c99274 100644 --- a/_proto/hapi/release/release.proto +++ b/_proto/hapi/release/release.proto @@ -44,4 +44,8 @@ message Release { // Hooks are all of the hooks declared for this release. repeated hapi.release.Hook hooks = 6; + + // Version is an int32 which represents the version of the release. + int32 version = 7; + } diff --git a/cmd/helm/get.go b/cmd/helm/get.go index 784bd6084..79be29ca8 100644 --- a/cmd/helm/get.go +++ b/cmd/helm/get.go @@ -92,8 +92,9 @@ func (g *getCmd) run() error { 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, "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, res.Release.Config.Raw) fmt.Fprintln(g.out, "COMPUTED VALUES:") diff --git a/cmd/helm/get_test.go b/cmd/helm/get_test.go index 0ee6ff356..d487dc40a 100644 --- a/cmd/helm/get_test.go +++ b/cmd/helm/get_test.go @@ -36,7 +36,7 @@ func TestGetCmd(t *testing.T) { name: "with a release", resp: releaseMock("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", diff --git a/cmd/helm/helm_test.go b/cmd/helm/helm_test.go index 1a0a8a338..0939abaf2 100644 --- a/cmd/helm/helm_test.go +++ b/cmd/helm/helm_test.go @@ -43,7 +43,8 @@ func releaseMock(name string) *release.Release { {Name: "foo.tpl", Data: []byte("Hello")}, }, }, - Config: &chart.Config{Raw: `name: "value"`}, + Config: &chart.Config{Raw: `name: "value"`}, + Version: 1, } } diff --git a/cmd/helm/list.go b/cmd/helm/list.go index ede7cb01d..0897f6b56 100644 --- a/cmd/helm/list.go +++ b/cmd/helm/list.go @@ -141,12 +141,13 @@ func (l *listCmd) run() error { func formatList(rels []*release.Release) string { table := uitable.New() table.MaxColWidth = 30 - table.AddRow("NAME", "UPDATED", "STATUS", "CHART") + table.AddRow("NAME", "VERSION", "UPDATED", "STATUS", "CHART") for _, r := range rels { c := fmt.Sprintf("%s-%s", r.Chart.Metadata.Name, r.Chart.Metadata.Version) t := timeconv.String(r.Info.LastDeployed) 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() } diff --git a/cmd/helm/list_test.go b/cmd/helm/list_test.go index c3bec76ec..2378835c5 100644 --- a/cmd/helm/list_test.go +++ b/cmd/helm/list_test.go @@ -52,7 +52,7 @@ func TestListRun(t *testing.T) { }, 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) { resp: []*release.Release{ 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", }, } diff --git a/cmd/tiller/release_server.go b/cmd/tiller/release_server.go index 7be145c32..c628ff8b7 100644 --- a/cmd/tiller/release_server.go +++ b/cmd/tiller/release_server.go @@ -277,6 +277,7 @@ func (s *releaseServer) prepareRelease(req *services.InstallReleaseRequest) (*re }, Manifest: b.String(), Hooks: hooks, + Version: 1, } return rel, nil } diff --git a/pkg/proto/hapi/release/release.pb.go b/pkg/proto/hapi/release/release.pb.go index fc59fecbb..5193d1d93 100644 --- a/pkg/proto/hapi/release/release.pb.go +++ b/pkg/proto/hapi/release/release.pb.go @@ -31,6 +31,8 @@ type Release struct { Manifest string `protobuf:"bytes,5,opt,name=manifest" json:"manifest,omitempty"` // Hooks are all of the hooks declared for this release. 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{} } @@ -71,19 +73,20 @@ func init() { } var fileDescriptor2 = []byte{ - // 224 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x64, 0x90, 0x3f, 0x4f, 0x85, 0x30, - 0x14, 0xc5, 0x83, 0xfc, 0x93, 0xab, 0x8b, 0x77, 0xd0, 0x86, 0x89, 0x38, 0x28, 0x71, 0x28, 0x89, - 0x7e, 0x03, 0x5d, 0x74, 0xed, 0xe8, 0x56, 0x49, 0x91, 0x46, 0x69, 0x09, 0xf0, 0x81, 0xfd, 0x28, - 0xd2, 0xde, 0xbe, 0x17, 0x78, 0x6f, 0xb9, 0x6d, 0xcf, 0xef, 0xe4, 0xf4, 0xb4, 0x50, 0xf6, 0x72, - 0xd4, 0xcd, 0xa4, 0x7e, 0x95, 0x9c, 0xd5, 0x61, 0xe5, 0xe3, 0x64, 0x17, 0x8b, 0xd7, 0x8e, 0xf1, - 0xa0, 0x95, 0x77, 0x3b, 0x67, 0x6f, 0xed, 0x0f, 0xd9, 0x4e, 0x80, 0x36, 0x9d, 0xdd, 0x81, 0xb6, - 0x97, 0xd3, 0xd2, 0xb4, 0xd6, 0x74, 0xfa, 0x3b, 0x80, 0xdb, 0x2d, 0x70, 0x93, 0xf4, 0xfb, 0xbf, - 0x08, 0x72, 0x41, 0x39, 0x88, 0x90, 0x18, 0x39, 0x28, 0x16, 0x55, 0x51, 0x5d, 0x08, 0xbf, 0xc7, - 0x07, 0x48, 0x5c, 0x3c, 0xbb, 0x58, 0xb5, 0xab, 0x67, 0xe4, 0xdb, 0x7e, 0xfc, 0x63, 0x25, 0xc2, - 0x73, 0x7c, 0x84, 0xd4, 0xc7, 0xb2, 0xd8, 0x1b, 0x6f, 0xc8, 0x48, 0x37, 0xbd, 0xb9, 0x29, 0x88, - 0xe3, 0x13, 0x64, 0x54, 0x8c, 0x25, 0xdb, 0xc8, 0xe0, 0xf4, 0x44, 0x04, 0x07, 0x96, 0x70, 0x39, - 0x48, 0xa3, 0x3b, 0x35, 0x2f, 0x2c, 0xf5, 0xa5, 0x8e, 0x67, 0xac, 0x21, 0x75, 0x1f, 0x32, 0xb3, - 0xac, 0x8a, 0xcf, 0x9b, 0xbd, 0xaf, 0x48, 0x90, 0xe1, 0xb5, 0xf8, 0xcc, 0x83, 0xfc, 0x95, 0xf9, - 0x47, 0xbf, 0xfc, 0x07, 0x00, 0x00, 0xff, 0xff, 0x96, 0x35, 0x9e, 0xef, 0x83, 0x01, 0x00, 0x00, + // 239 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b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