From 6d26024a2792925d16a33fd8c09f107d7166e834 Mon Sep 17 00:00:00 2001 From: vaikas-google Date: Wed, 31 Aug 2016 11:57:13 -0700 Subject: [PATCH] first cut of version on client and server --- _proto/Makefile | 13 +- _proto/hapi/services/tiller.proto | 13 ++ _proto/hapi/version/version.proto | 30 +++++ cmd/helm/helm.go | 1 + cmd/helm/helm_test.go | 13 ++ cmd/helm/installer/install.go | 2 +- cmd/helm/version.go | 41 +++++-- cmd/tiller/release_server.go | 6 + pkg/chartutil/values_test.go | 2 +- pkg/helm/client.go | 15 +++ pkg/helm/interface.go | 1 + pkg/helm/option.go | 11 +- pkg/proto/hapi/services/tiller.pb.go | 170 ++++++++++++++++++--------- pkg/proto/hapi/version/version.pb.go | 66 +++++++++++ pkg/version/version.go | 45 ++++++- versioning.mk | 6 +- 16 files changed, 363 insertions(+), 72 deletions(-) create mode 100644 _proto/hapi/version/version.proto create mode 100644 pkg/proto/hapi/version/version.pb.go diff --git a/_proto/Makefile b/_proto/Makefile index 1f188adfc..38f4ba6c2 100644 --- a/_proto/Makefile +++ b/_proto/Makefile @@ -20,19 +20,26 @@ services_ias = $(subst $(space),$(comma),$(addsuffix =$(import_path)/$(services_ services_pbs = $(sort $(wildcard hapi/services/*.proto)) services_pkg = services +version_ias = $(subst $(space),$(comma),$(addsuffix =$(import_path)/$(version_pkg),$(addprefix M,$(version_pbs)))) +version_pbs = $(sort $(wildcard hapi/version/*.proto)) +version_pkg = version + google_deps = Mgoogle/protobuf/timestamp.proto=github.com/golang/protobuf/ptypes/timestamp,Mgoogle/protobuf/any.proto=github.com/golang/protobuf/ptypes/any .PHONY: all -all: chart release services +all: chart release services version chart: PATH=../bin:$(PATH) protoc --$(target)_out=plugins=$(plugins),$(google_deps),$(chart_ias):$(dst) $(chart_pbs) release: - PATH=../bin:$(PATH) protoc --$(target)_out=plugins=$(plugins),$(google_deps),$(chart_ias):$(dst) $(release_pbs) + PATH=../bin:$(PATH) protoc --$(target)_out=plugins=$(plugins),$(google_deps),$(chart_ias),$(version_ias):$(dst) $(release_pbs) services: - PATH=../bin:$(PATH) protoc --$(target)_out=plugins=$(plugins),$(google_deps),$(chart_ias),$(release_ias):$(dst) $(services_pbs) + PATH=../bin:$(PATH) protoc --$(target)_out=plugins=$(plugins),$(google_deps),$(chart_ias),$(version_ias),$(release_ias):$(dst) $(services_pbs) + +version: + PATH=../bin:$(PATH) protoc --$(target)_out=plugins=$(plugins),$(google_deps):$(dst) $(version_pbs) .PHONY: clean clean: diff --git a/_proto/hapi/services/tiller.proto b/_proto/hapi/services/tiller.proto index 4d5da0085..46f999a07 100644 --- a/_proto/hapi/services/tiller.proto +++ b/_proto/hapi/services/tiller.proto @@ -21,6 +21,7 @@ import "hapi/chart/config.proto"; import "hapi/release/release.proto"; import "hapi/release/info.proto"; import "hapi/release/status.proto"; +import "hapi/version/version.proto"; option go_package = "services"; @@ -65,6 +66,10 @@ service ReleaseService { // UninstallRelease requests deletion of a named release. rpc UninstallRelease(UninstallReleaseRequest) returns (UninstallReleaseResponse) { } + + // GetVersion returns the current version of the server. + rpc GetVersion(GetVersionRequest) returns (GetVersionResponse) { +} } // ListReleasesRequest requests a list of releases. @@ -229,3 +234,11 @@ message UninstallReleaseResponse { // Release is the release that was marked deleted. hapi.release.Release release = 1; } + +// GetVersionRequest requests for version information. +message GetVersionRequest { +} + +message GetVersionResponse { + hapi.version.Version Version = 1; +} diff --git a/_proto/hapi/version/version.proto b/_proto/hapi/version/version.proto new file mode 100644 index 000000000..1f68253ed --- /dev/null +++ b/_proto/hapi/version/version.proto @@ -0,0 +1,30 @@ +// Copyright 2016 The Kubernetes Authors All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package hapi.version; + +option go_package = "version"; + +message Version { + uint32 major = 1; + uint32 minor = 2; + uint32 patch = 3; + string pre_release = 4; + string build_metadata = 5; + string git_version = 6; + string git_commit = 7; + string git_tree_state = 8; +} diff --git a/cmd/helm/helm.go b/cmd/helm/helm.go index 7205a20f2..78e058b02 100644 --- a/cmd/helm/helm.go +++ b/cmd/helm/helm.go @@ -98,6 +98,7 @@ func newRootCmd(out io.Writer) *cobra.Command { newFetchCmd(out), newVerifyCmd(out), newUpdateCmd(out), + newVersionCmd(nil, out), ) return cmd } diff --git a/cmd/helm/helm_test.go b/cmd/helm/helm_test.go index 71c0aee1d..f6a26edd1 100644 --- a/cmd/helm/helm_test.go +++ b/cmd/helm/helm_test.go @@ -31,6 +31,7 @@ import ( "k8s.io/helm/pkg/proto/hapi/chart" "k8s.io/helm/pkg/proto/hapi/release" rls "k8s.io/helm/pkg/proto/hapi/services" + "k8s.io/helm/pkg/proto/hapi/version" ) var mockHookTemplate = `apiVersion: v1 @@ -145,6 +146,18 @@ func (c *fakeReleaseClient) ReleaseStatus(rlsName string, opts ...helm.StatusOpt return nil, fmt.Errorf("No such release: %s", rlsName) } +func (c *fakeReleaseClient) GetVersion(opts ...helm.VersionOption) (*rls.GetVersionResponse, error) { + return &rls.GetVersionResponse{ + Version: &version.Version{ + Major: 1, + Minor: 2, + Patch: 3, + PreRelease: "fakeclient", + BuildMetadata: "testonly", + }, + }, nil +} + func (c *fakeReleaseClient) UpdateRelease(rlsName string, chStr string, opts ...helm.UpdateOption) (*rls.UpdateReleaseResponse, error) { return nil, nil } diff --git a/cmd/helm/installer/install.go b/cmd/helm/installer/install.go index 0bfd197e8..84253ed18 100644 --- a/cmd/helm/installer/install.go +++ b/cmd/helm/installer/install.go @@ -62,7 +62,7 @@ func Install(namespace, image string, verbose bool) error { if image == "" { // strip git sha off version - tag := strings.Split(version.Version, "+")[0] + tag := strings.Split(version.GetVersion(), "+")[0] image = fmt.Sprintf("%s:%s", defaultImage, tag) } diff --git a/cmd/helm/version.go b/cmd/helm/version.go index d66221491..58dbcc97d 100644 --- a/cmd/helm/version.go +++ b/cmd/helm/version.go @@ -18,20 +18,45 @@ package main import ( "fmt" + "io" "github.com/spf13/cobra" + "k8s.io/helm/pkg/helm" "k8s.io/helm/pkg/version" ) -func init() { - RootCommand.AddCommand(versionCmd) +type versionCmd struct { + out io.Writer + client helm.Interface } -var versionCmd = &cobra.Command{ - Use: "version", - Short: "print the client version information", - Run: func(cmd *cobra.Command, args []string) { - fmt.Println(version.Version) - }, +func newVersionCmd(c helm.Interface, out io.Writer) *cobra.Command { + version := &versionCmd{ + client: c, + out: out, + } + cmd := &cobra.Command{ + Use: "version", + Short: "print the client/server version information", + PersistentPreRunE: setupConnection, + RunE: func(cmd *cobra.Command, args []string) error { + version.client = ensureHelmClient(version.client) + return version.run() + }, + } + return cmd +} + +func (v *versionCmd) run() error { + // Regardless of whether we can talk to server or not, just print the client + // version. + fmt.Printf("%+v\n", version.GetVersionProto()) + + resp, err := v.client.GetVersion() + if err != nil { + return err + } + fmt.Printf("%+v\n", resp.Version) + return nil } diff --git a/cmd/tiller/release_server.go b/cmd/tiller/release_server.go index 414bf402b..678570841 100644 --- a/cmd/tiller/release_server.go +++ b/cmd/tiller/release_server.go @@ -36,6 +36,7 @@ import ( "k8s.io/helm/pkg/proto/hapi/services" "k8s.io/helm/pkg/storage/driver" "k8s.io/helm/pkg/timeconv" + "k8s.io/helm/pkg/version" "k8s.io/kubernetes/pkg/api/unversioned" ) @@ -175,6 +176,11 @@ func filterReleases(filter string, rels []*release.Release) ([]*release.Release, return matches, nil } +func (s *releaseServer) GetVersion(c ctx.Context, req *services.GetVersionRequest) (*services.GetVersionResponse, error) { + v := version.GetVersionProto() + return &services.GetVersionResponse{Version: &v}, nil +} + func (s *releaseServer) GetReleaseStatus(c ctx.Context, req *services.GetReleaseStatusRequest) (*services.GetReleaseStatusResponse, error) { if req.Name == "" { return nil, errMissingRelease diff --git a/pkg/chartutil/values_test.go b/pkg/chartutil/values_test.go index 33f0854a8..e5a11600f 100644 --- a/pkg/chartutil/values_test.go +++ b/pkg/chartutil/values_test.go @@ -61,7 +61,7 @@ water: for _, tt := range tests { data, err = ReadValues([]byte(tt)) if err != nil { - t.Fatalf("Error parsing bytes: %s", err) + t.Fatalf("Error parsing bytes (%s): %s", tt, err) } if data == nil { t.Errorf(`YAML string "%s" gave a nil map`, tt) diff --git a/pkg/helm/client.go b/pkg/helm/client.go index 3c9cdfe71..95ad41c5e 100644 --- a/pkg/helm/client.go +++ b/pkg/helm/client.go @@ -23,6 +23,7 @@ import ( "k8s.io/helm/pkg/chartutil" rls "k8s.io/helm/pkg/proto/hapi/services" + // version "k8s.io/helm/pkg/proto/hapi/version" ) const ( @@ -120,6 +121,20 @@ func (h *Client) UpdateRelease(rlsName string, chStr string, opts ...UpdateOptio return h.opts.rpcUpdateRelease(rlsName, chart, rls.NewReleaseServiceClient(c), opts...) } +// Version returns the server version +// +// Note: there aren't currently any supported StatusOptions, +// but they are kept in the API signature as a placeholder for future additions. +func (h *Client) GetVersion(opts ...VersionOption) (*rls.GetVersionResponse, error) { + c, err := grpc.Dial(h.opts.host, grpc.WithInsecure()) + if err != nil { + return nil, err + } + defer c.Close() + + return h.opts.rpcGetVersion(rls.NewReleaseServiceClient(c), opts...) +} + // ReleaseStatus returns the given release's status. // // Note: there aren't currently any supported StatusOptions, diff --git a/pkg/helm/interface.go b/pkg/helm/interface.go index 528af8908..1510b4d56 100644 --- a/pkg/helm/interface.go +++ b/pkg/helm/interface.go @@ -28,4 +28,5 @@ type Interface interface { ReleaseStatus(rlsName string, opts ...StatusOption) (*rls.GetReleaseStatusResponse, error) UpdateRelease(rlsName, chStr string, opts ...UpdateOption) (*rls.UpdateReleaseResponse, error) ReleaseContent(rlsName string, opts ...ContentOption) (*rls.GetReleaseContentResponse, error) + GetVersion(opts ...VersionOption) (*rls.GetVersionResponse, error) } diff --git a/pkg/helm/option.go b/pkg/helm/option.go index 5d72f1f58..269001742 100644 --- a/pkg/helm/option.go +++ b/pkg/helm/option.go @@ -219,7 +219,7 @@ func ContentReleaseVersion(version int32) ContentOption { type StatusOption func(*options) // StatusReleaseVersion will instruct Tiller to retrieve the status -// of a paritcular version of a release. +// of a particular version of a release. func StatusReleaseVersion(version int32) StatusOption { return func(opts *options) { opts.statusReq.Version = version @@ -230,6 +230,9 @@ func StatusReleaseVersion(version int32) StatusOption { // performing a UninstallRelease tiller rpc. type DeleteOption func(*options) +// VersionOption -- TODO +type VersionOption func(*options) + // UpdateOption allows specifying various settings // configurable by the helm client user for overriding // the defaults used when running the `helm upgrade` command. @@ -319,3 +322,9 @@ func (o *options) rpcGetReleaseContent(rlsName string, rlc rls.ReleaseServiceCli o.contentReq.Name = rlsName return rlc.GetReleaseContent(context.TODO(), &o.contentReq) } + +// Executes tiller.GetVersion RPC. +func (o *options) rpcGetVersion(rlc rls.ReleaseServiceClient, opts ...VersionOption) (*rls.GetVersionResponse, error) { + req := &rls.GetVersionRequest{} + return rlc.GetVersion(context.TODO(), req) +} diff --git a/pkg/proto/hapi/services/tiller.pb.go b/pkg/proto/hapi/services/tiller.pb.go index 33ed1133d..ba78f2836 100644 --- a/pkg/proto/hapi/services/tiller.pb.go +++ b/pkg/proto/hapi/services/tiller.pb.go @@ -22,6 +22,8 @@ It has these top-level messages: InstallReleaseResponse UninstallReleaseRequest UninstallReleaseResponse + GetVersionRequest + GetVersionResponse */ package services @@ -33,6 +35,7 @@ import hapi_chart "k8s.io/helm/pkg/proto/hapi/chart" import hapi_release3 "k8s.io/helm/pkg/proto/hapi/release" import hapi_release2 "k8s.io/helm/pkg/proto/hapi/release" import hapi_release1 "k8s.io/helm/pkg/proto/hapi/release" +import hapi_version "k8s.io/helm/pkg/proto/hapi/version" import ( context "golang.org/x/net/context" @@ -366,6 +369,31 @@ func (m *UninstallReleaseResponse) GetRelease() *hapi_release3.Release { return nil } +// GetVersionRequest requests for version information. +type GetVersionRequest struct { +} + +func (m *GetVersionRequest) Reset() { *m = GetVersionRequest{} } +func (m *GetVersionRequest) String() string { return proto.CompactTextString(m) } +func (*GetVersionRequest) ProtoMessage() {} +func (*GetVersionRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} } + +type GetVersionResponse struct { + Version *hapi_version.Version `protobuf:"bytes,1,opt,name=Version,json=version" json:"Version,omitempty"` +} + +func (m *GetVersionResponse) Reset() { *m = GetVersionResponse{} } +func (m *GetVersionResponse) String() string { return proto.CompactTextString(m) } +func (*GetVersionResponse) ProtoMessage() {} +func (*GetVersionResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} } + +func (m *GetVersionResponse) GetVersion() *hapi_version.Version { + if m != nil { + return m.Version + } + return nil +} + func init() { proto.RegisterType((*ListReleasesRequest)(nil), "hapi.services.tiller.ListReleasesRequest") proto.RegisterType((*ListSort)(nil), "hapi.services.tiller.ListSort") @@ -380,6 +408,8 @@ func init() { proto.RegisterType((*InstallReleaseResponse)(nil), "hapi.services.tiller.InstallReleaseResponse") proto.RegisterType((*UninstallReleaseRequest)(nil), "hapi.services.tiller.UninstallReleaseRequest") proto.RegisterType((*UninstallReleaseResponse)(nil), "hapi.services.tiller.UninstallReleaseResponse") + proto.RegisterType((*GetVersionRequest)(nil), "hapi.services.tiller.GetVersionRequest") + proto.RegisterType((*GetVersionResponse)(nil), "hapi.services.tiller.GetVersionResponse") proto.RegisterEnum("hapi.services.tiller.ListSort_SortBy", ListSort_SortBy_name, ListSort_SortBy_value) proto.RegisterEnum("hapi.services.tiller.ListSort_SortOrder", ListSort_SortOrder_name, ListSort_SortOrder_value) } @@ -410,6 +440,8 @@ type ReleaseServiceClient interface { InstallRelease(ctx context.Context, in *InstallReleaseRequest, opts ...grpc.CallOption) (*InstallReleaseResponse, error) // UninstallRelease requests deletion of a named release. UninstallRelease(ctx context.Context, in *UninstallReleaseRequest, opts ...grpc.CallOption) (*UninstallReleaseResponse, error) + // GetVersion returns the current version of the server. + GetVersion(ctx context.Context, in *GetVersionRequest, opts ...grpc.CallOption) (*GetVersionResponse, error) } type releaseServiceClient struct { @@ -497,6 +529,15 @@ func (c *releaseServiceClient) UninstallRelease(ctx context.Context, in *Uninsta return out, nil } +func (c *releaseServiceClient) GetVersion(ctx context.Context, in *GetVersionRequest, opts ...grpc.CallOption) (*GetVersionResponse, error) { + out := new(GetVersionResponse) + err := grpc.Invoke(ctx, "/hapi.services.tiller.ReleaseService/GetVersion", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // Server API for ReleaseService service type ReleaseServiceServer interface { @@ -515,6 +556,8 @@ type ReleaseServiceServer interface { InstallRelease(context.Context, *InstallReleaseRequest) (*InstallReleaseResponse, error) // UninstallRelease requests deletion of a named release. UninstallRelease(context.Context, *UninstallReleaseRequest) (*UninstallReleaseResponse, error) + // GetVersion returns the current version of the server. + GetVersion(context.Context, *GetVersionRequest) (*GetVersionResponse, error) } func RegisterReleaseServiceServer(s *grpc.Server, srv ReleaseServiceServer) { @@ -602,6 +645,18 @@ func _ReleaseService_UninstallRelease_Handler(srv interface{}, ctx context.Conte return out, nil } +func _ReleaseService_GetVersion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { + in := new(GetVersionRequest) + if err := dec(in); err != nil { + return nil, err + } + out, err := srv.(ReleaseServiceServer).GetVersion(ctx, in) + if err != nil { + return nil, err + } + return out, nil +} + var _ReleaseService_serviceDesc = grpc.ServiceDesc{ ServiceName: "hapi.services.tiller.ReleaseService", HandlerType: (*ReleaseServiceServer)(nil), @@ -626,6 +681,10 @@ var _ReleaseService_serviceDesc = grpc.ServiceDesc{ MethodName: "UninstallRelease", Handler: _ReleaseService_UninstallRelease_Handler, }, + { + MethodName: "GetVersion", + Handler: _ReleaseService_GetVersion_Handler, + }, }, Streams: []grpc.StreamDesc{ { @@ -637,58 +696,61 @@ var _ReleaseService_serviceDesc = grpc.ServiceDesc{ } var fileDescriptor0 = []byte{ - // 841 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x9c, 0x56, 0xdd, 0x6e, 0xeb, 0x44, - 0x10, 0xae, 0xf3, 0xe3, 0x24, 0x93, 0xb6, 0x4a, 0x97, 0xb6, 0x71, 0x2d, 0x40, 0x95, 0x11, 0x50, - 0x0a, 0x24, 0x10, 0x6e, 0x11, 0x52, 0x9a, 0x46, 0x6d, 0xd5, 0x90, 0x4a, 0x1b, 0x2a, 0x24, 0x2e, - 0x88, 0xdc, 0x64, 0xd3, 0x18, 0x5c, 0x3b, 0x78, 0x37, 0x11, 0x7d, 0x04, 0x5e, 0x83, 0xa7, 0xe0, - 0x86, 0x27, 0xe3, 0x86, 0xf5, 0xae, 0xd7, 0x27, 0x4e, 0xec, 0x73, 0x7c, 0x72, 0xe3, 0xec, 0xee, - 0x7c, 0xfb, 0xcd, 0xcc, 0x37, 0xb3, 0xd3, 0x82, 0x39, 0xb7, 0x17, 0x4e, 0x9b, 0x92, 0x60, 0xe5, - 0x4c, 0x08, 0x6d, 0x33, 0xc7, 0x75, 0x49, 0xd0, 0x5a, 0x04, 0x3e, 0xf3, 0xd1, 0x71, 0x68, 0x6b, - 0x29, 0x5b, 0x4b, 0xda, 0xcc, 0x53, 0x71, 0x63, 0x32, 0xb7, 0x03, 0x26, 0xbf, 0x12, 0x6d, 0x36, - 0xd7, 0xcf, 0x7d, 0x6f, 0xe6, 0x3c, 0x47, 0x06, 0xe9, 0x22, 0x20, 0x2e, 0xb1, 0x29, 0x51, 0xbf, - 0x89, 0x4b, 0xca, 0xe6, 0x78, 0x33, 0x3f, 0x32, 0x9c, 0x25, 0x0c, 0x94, 0xd9, 0x6c, 0x49, 0xa5, - 0xc9, 0xfa, 0xbb, 0x00, 0x1f, 0x0c, 0x1c, 0xca, 0xb0, 0x34, 0x52, 0x4c, 0xfe, 0x58, 0x12, 0xca, - 0xd0, 0x31, 0x94, 0x5d, 0xe7, 0xc5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, 0x27, 0x8b, 0x40, 0x17, 0xbe, - 0x47, 0x49, 0x58, 0x85, 0x89, 0xbf, 0xf4, 0xe2, 0x2a, 0x88, 0x0d, 0x42, 0x50, 0xf2, 0xc8, 0x9f, - 0xaa, 0x06, 0x62, 0x1d, 0x22, 0x99, 0xcf, 0x6c, 0x57, 0xe8, 0xcf, 0x91, 0x62, 0x83, 0xbe, 0x85, - 0x6a, 0x94, 0x1c, 0xe5, 0xca, 0x16, 0x2f, 0xea, 0x9d, 0x93, 0x64, 0xca, 0x91, 0x47, 0x1c, 0xc3, - 0xac, 0x1b, 0x68, 0xde, 0x10, 0x15, 0x89, 0x54, 0x44, 0xf5, 0x44, 0xe8, 0xd7, 0x7e, 0x21, 0x22, - 0x98, 0xd0, 0x2f, 0x5f, 0x23, 0x03, 0x2a, 0x2b, 0x12, 0x50, 0xc7, 0xf7, 0x44, 0x38, 0x65, 0xac, - 0xb6, 0x16, 0x03, 0x63, 0x9b, 0x28, 0xca, 0x2b, 0x8d, 0xe9, 0x33, 0x28, 0x85, 0x2d, 0x2b, 0x68, - 0xea, 0x1d, 0x94, 0x8c, 0xf3, 0x8e, 0x5b, 0xb0, 0xb0, 0xa3, 0x0f, 0xa1, 0x16, 0xe2, 0xe9, 0xc2, - 0x9e, 0x10, 0x91, 0x6d, 0x0d, 0xbf, 0x39, 0xb0, 0x6e, 0xd7, 0xbd, 0xf6, 0x7c, 0x8f, 0x11, 0x8f, - 0xed, 0x16, 0xff, 0x00, 0xce, 0x52, 0x98, 0xa2, 0x04, 0xda, 0x50, 0x89, 0x42, 0x13, 0x6c, 0x99, - 0xba, 0x2a, 0x94, 0xf5, 0x2f, 0x2f, 0xf1, 0xe3, 0x62, 0x6a, 0x33, 0xa2, 0x4c, 0x6f, 0x09, 0xea, - 0x73, 0x5e, 0xf6, 0xf0, 0xe9, 0x47, 0x5a, 0x1c, 0x49, 0x6e, 0x39, 0x1f, 0x7a, 0xe1, 0x17, 0x4b, - 0x3b, 0xba, 0x04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 0xd6, 0xde, 0x37, 0x1a, 0xa2, 0xd0, - 0xd8, 0x9c, 0x4a, 0xe8, 0xeb, 0x74, 0x8e, 0x8c, 0x31, 0x68, 0xb6, 0xf2, 0xc2, 0x95, 0x5b, 0xb4, - 0x82, 0xa3, 0xad, 0x51, 0x82, 0xde, 0x49, 0x93, 0x9c, 0x5e, 0x66, 0x3b, 0x37, 0x3e, 0xf6, 0xfb, - 0x1b, 0x1c, 0x24, 0x1e, 0x2d, 0xca, 0x50, 0x2b, 0x6d, 0x30, 0x99, 0x5f, 0xe6, 0xc2, 0xc6, 0xbe, - 0x5e, 0xe0, 0x30, 0xd9, 0xd8, 0x28, 0x83, 0x20, 0xf5, 0xed, 0x9b, 0x5f, 0xe5, 0x03, 0xc7, 0xee, - 0x78, 0x1d, 0x37, 0x5b, 0x32, 0xab, 0x8e, 0x19, 0x8f, 0x24, 0xab, 0x8e, 0x59, 0x9d, 0x6e, 0xed, - 0x5d, 0xc1, 0x2f, 0x55, 0x85, 0x7e, 0xd2, 0xc5, 0xff, 0x4f, 0xdf, 0xfd, 0x1f, 0x00, 0x00, 0xff, - 0xff, 0xd9, 0x8f, 0xae, 0xcb, 0xf4, 0x09, 0x00, 0x00, + // 893 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x9c, 0x56, 0x5f, 0x6f, 0xe3, 0x44, + 0x10, 0x3f, 0x27, 0xa9, 0x93, 0x4c, 0xda, 0x2a, 0xdd, 0x6b, 0x1b, 0xd7, 0x02, 0x74, 0x32, 0x82, + 0x0b, 0x07, 0x24, 0x10, 0x5e, 0x11, 0x52, 0x2e, 0x17, 0xf5, 0xaa, 0x0b, 0x39, 0x69, 0x43, 0x41, + 0xe2, 0x81, 0xc8, 0x4d, 0x36, 0x17, 0x83, 0x6b, 0x07, 0xef, 0x26, 0xa2, 0x1f, 0x81, 0xcf, 0xc0, + 0x1b, 0xdf, 0x83, 0x4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, 0x32, 0xda, 0xdd, 0xc2, + 0xf8, 0xc4, 0xef, 0xaf, 0x70, 0x94, 0x1a, 0x08, 0x28, 0x47, 0xad, 0xac, 0xa1, 0x67, 0x7f, 0x5e, + 0x08, 0x9b, 0xf8, 0xba, 0x85, 0xe3, 0x74, 0xd3, 0xa0, 0x1c, 0x82, 0xcc, 0xb9, 0x62, 0x7f, 0x51, + 0x0c, 0x9c, 0xb8, 0xe3, 0x75, 0xdc, 0xbd, 0xee, 0x79, 0x75, 0xcc, 0x69, 0xc0, 0xbc, 0x3a, 0xe6, + 0x75, 0x11, 0x77, 0xea, 0x02, 0xdc, 0x77, 0x00, 0x7a, 0x9e, 0x5b, 0x90, 0x74, 0xe3, 0xd8, 0xed, + 0xc7, 0x81, 0xda, 0xc5, 0x4b, 0xf8, 0xb9, 0xa6, 0x71, 0x37, 0xa6, 0xf8, 0xfb, 0xf7, 0xcd, 0x7f, + 0x01, 0x00, 0x00, 0xff, 0xff, 0x14, 0xb2, 0x9f, 0x07, 0xcf, 0x0a, 0x00, 0x00, } diff --git a/pkg/proto/hapi/version/version.pb.go b/pkg/proto/hapi/version/version.pb.go new file mode 100644 index 000000000..ef08a6b64 --- /dev/null +++ b/pkg/proto/hapi/version/version.pb.go @@ -0,0 +1,66 @@ +// Code generated by protoc-gen-go. +// source: hapi/version/version.proto +// DO NOT EDIT! + +/* +Package version is a generated protocol buffer package. + +It is generated from these files: + hapi/version/version.proto + +It has these top-level messages: + Version +*/ +package version + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +const _ = proto.ProtoPackageIsVersion1 + +type Version struct { + Major uint32 `protobuf:"varint,1,opt,name=major" json:"major,omitempty"` + Minor uint32 `protobuf:"varint,2,opt,name=minor" json:"minor,omitempty"` + Patch uint32 `protobuf:"varint,3,opt,name=patch" json:"patch,omitempty"` + PreRelease string `protobuf:"bytes,4,opt,name=pre_release,json=preRelease" json:"pre_release,omitempty"` + BuildMetadata string `protobuf:"bytes,5,opt,name=build_metadata,json=buildMetadata" json:"build_metadata,omitempty"` + GitVersion string `protobuf:"bytes,6,opt,name=git_version,json=gitVersion" json:"git_version,omitempty"` + GitCommit string `protobuf:"bytes,7,opt,name=git_commit,json=gitCommit" json:"git_commit,omitempty"` + GitTreeState string `protobuf:"bytes,8,opt,name=git_tree_state,json=gitTreeState" json:"git_tree_state,omitempty"` +} + +func (m *Version) Reset() { *m = Version{} } +func (m *Version) String() string { return proto.CompactTextString(m) } +func (*Version) ProtoMessage() {} +func (*Version) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +func init() { + proto.RegisterType((*Version)(nil), "hapi.version.Version") +} + +var fileDescriptor0 = []byte{ + // 225 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x34, 0xd0, 0xb1, 0x4e, 0xc3, 0x30, + 0x10, 0x06, 0x60, 0x05, 0x68, 0x43, 0x8e, 0xb6, 0x83, 0xc5, 0x60, 0x21, 0x21, 0x10, 0x02, 0x89, + 0xa9, 0x0c, 0xbc, 0x01, 0xcc, 0x2c, 0x01, 0x31, 0xb0, 0x58, 0xd7, 0xf6, 0x44, 0x8d, 0xea, 0xd8, + 0x72, 0x0e, 0xde, 0x9d, 0xad, 0xf6, 0xd9, 0x99, 0x92, 0xff, 0xfb, 0x4f, 0x97, 0x53, 0xe0, 0x6a, + 0x8f, 0xc1, 0x3e, 0xfd, 0x51, 0x1c, 0xad, 0x1f, 0xa6, 0xe7, 0x3a, 0x44, 0xcf, 0x5e, 0x2d, 0x72, + 0xb7, 0xae, 0x76, 0xf7, 0xdf, 0x40, 0xfb, 0x59, 0xde, 0xd5, 0x25, 0xcc, 0x1c, 0xfe, 0xf8, 0xa8, + 0x9b, 0xdb, 0xe6, 0x71, 0xd9, 0x97, 0x20, 0x6a, 0x87, 0xa4, 0x27, 0x55, 0x73, 0xc8, 0x1a, 0x90, + 0xb7, 0x7b, 0x7d, 0x5a, 0x54, 0x82, 0xba, 0x81, 0x8b, 0x10, 0xc9, 0x44, 0x3a, 0x10, 0x8e, 0xa4, + 0xcf, 0x52, 0xd7, 0xf5, 0x90, 0xa8, 0x2f, 0xa2, 0x1e, 0x60, 0xb5, 0xf9, 0xb5, 0x87, 0x9d, 0x71, + 0xc4, 0xb8, 0x43, 0x46, 0x3d, 0x93, 0x99, 0xa5, 0xe8, 0x5b, 0xc5, 0xbc, 0xe7, 0xdb, 0xb2, 0xa9, + 0x47, 0xea, 0x79, 0xd9, 0x93, 0x68, 0x3a, 0xf5, 0x1a, 0x72, 0x32, 0x5b, 0xef, 0x9c, 0x65, 0xdd, + 0x4a, 0xdf, 0x25, 0x79, 0x15, 0x50, 0xf7, 0xb0, 0xca, 0x35, 0x47, 0x22, 0x33, 0x32, 0x32, 0xe9, + 0x73, 0x19, 0x59, 0x24, 0xfd, 0x48, 0xf8, 0x9e, 0xed, 0xa5, 0xfb, 0x6a, 0xeb, 0x17, 0x36, 0x73, + 0xf9, 0x37, 0xcf, 0xc7, 0x00, 0x00, 0x00, 0xff, 0xff, 0x87, 0xdf, 0xc1, 0x73, 0x39, 0x01, 0x00, + 0x00, +} diff --git a/pkg/version/version.go b/pkg/version/version.go index 8994d4b91..533a639ba 100644 --- a/pkg/version/version.go +++ b/pkg/version/version.go @@ -17,10 +17,51 @@ limitations under the License. // Package version represents the current version of the project. package version // import "k8s.io/helm/pkg/version" +import ( + "fmt" + + "k8s.io/helm/pkg/proto/hapi/version" +) + // Version is the current version of the Helm. // Update this whenever making a new release. -// The version is of the format Major.Minor.Patch +// The version is of the format Major.Minor.Patch[-Prerelease][+BuildMetadata] +// // Increment major number for new feature additions and behavioral changes. // Increment minor number for bug fixes and performance enhancements. // Increment patch number for critical fixes to existing releases. -var Version = "v2.0.0-alpha.4" +// +// BuildMetadata gets filled in during build, do not touch +// GitCommit gets filled in during build, do not touch +var ( + Major uint32 = 2 + Minor uint32 = 0 + Patch uint32 = 0 + PreRelease = "alpha.4" + BuildMetadata = "" + GitCommit = "" +) + +// GetVersion returns the semver string of the version +func GetVersion() string { + version := fmt.Sprintf("v%d.%d.%d", Major, Minor, Patch) + if PreRelease != "" { + version = version + "-" + PreRelease + } + if BuildMetadata != "" { + version = version + "+" + BuildMetadata + } + return version +} + +// GetVersionProto returns protobuf representing the version +func GetVersionProto() version.Version { + return version.Version{ + Major: Major, + Minor: Minor, + Patch: Patch, + PreRelease: PreRelease, + BuildMetadata: BuildMetadata, + GitCommit: GitCommit, + } +} diff --git a/versioning.mk b/versioning.mk index 3b8645392..2c6e1b4b5 100644 --- a/versioning.mk +++ b/versioning.mk @@ -1,5 +1,6 @@ MUTABLE_VERSION ?= canary +GIT_COMMIT := $(shell git rev-parse HEAD) GIT_SHA := $(shell git rev-parse --short HEAD) GIT_TAG := $(shell git describe --tags --abbrev=0 2>/dev/null) @@ -9,12 +10,13 @@ ifdef VERSION endif DOCKER_VERSION ?= git-${GIT_SHA} -BINARY_VERSION ?= ${GIT_TAG}+${GIT_SHA} +BINARY_VERSION ?= ${GIT_TAG}-${GIT_SHA} IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${SHORT_NAME}:${DOCKER_VERSION} MUTABLE_IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${SHORT_NAME}:${MUTABLE_VERSION} -LDFLAGS += -X k8s.io/helm/pkg/version.Version=${BINARY_VERSION} +LDFLAGS += -X k8s.io/helm/pkg/version.BuildMetadata=${BINARY_VERSION} +LDFLAGS += -X k8s.io/helm/pkg/version.GitCommit=${GIT_COMMIT} DOCKER_PUSH = docker push ifeq ($(DOCKER_REGISTRY),gcr.io)