Address cr comments

reviewable/pr1126/r4
vaikas-google 8 years ago
parent cbec79482a
commit f8adf7f4d2

@ -19,11 +19,8 @@ package hapi.version;
option go_package = "version"; option go_package = "version";
message Version { message Version {
uint32 major = 1; // Sem ver string for the version
uint32 minor = 2; string sem_ver = 1;
uint32 patch = 3;
string pre_release = 4;
string build_metadata = 5;
string git_version = 6; string git_version = 6;
string git_commit = 7; string git_commit = 7;
string git_tree_state = 8; string git_tree_state = 8;

@ -149,11 +149,7 @@ func (c *fakeReleaseClient) ReleaseStatus(rlsName string, opts ...helm.StatusOpt
func (c *fakeReleaseClient) GetVersion(opts ...helm.VersionOption) (*rls.GetVersionResponse, error) { func (c *fakeReleaseClient) GetVersion(opts ...helm.VersionOption) (*rls.GetVersionResponse, error) {
return &rls.GetVersionResponse{ return &rls.GetVersionResponse{
Version: &version.Version{ Version: &version.Version{
Major: 1, SemVer: "1.2.3-fakeclient+testonly",
Minor: 2,
Patch: 3,
PreRelease: "fakeclient",
BuildMetadata: "testonly",
}, },
}, nil }, nil
} }

@ -62,7 +62,7 @@ func Install(namespace, image string, verbose bool) error {
if image == "" { if image == "" {
// strip git sha off version // strip git sha off version
tag := strings.Split(version.GetVersion(), "+")[0] tag := strings.Split(version.Version, "+")[0]
image = fmt.Sprintf("%s:%s", defaultImage, tag) image = fmt.Sprintf("%s:%s", defaultImage, tag)
} }

@ -54,15 +54,8 @@ type Dependency struct {
// Repository is the repository URL. Appending '/index.yaml' to this should // Repository is the repository URL. Appending '/index.yaml' to this should
// return the repo index. // return the repo index.
Repository string `protobuf:"bytes,2,opt,name=repository" json:"repository,omitempty"` Repository string `protobuf:"bytes,2,opt,name=repository" json:"repository,omitempty"`
// Version is a SemVer 2 version range. // Version is a SemVer 2 version.
// This can be an exact version or any of the version range operators
// described here: https://github.com/Masterminds/semver/blob/master/README.md
Version string `protobuf:"bytes,3,opt,name=version" json:"version,omitempty"` Version string `protobuf:"bytes,3,opt,name=version" json:"version,omitempty"`
// FetchedVersion is a computed field that indicates exactly which version
// was fetched by tooling. It is an exact version (not a range).
//
// This plays the roll of a "lock" for this dependency.
FetchedVersion string `protobuf:"bytes,4,opt,name=fetchedVersion" json:"fetchedVersion,omitempty"`
} }
func (m *Dependency) Reset() { *m = Dependency{} } func (m *Dependency) Reset() { *m = Dependency{} }
@ -122,27 +115,26 @@ func init() {
} }
var fileDescriptor2 = []byte{ var fileDescriptor2 = []byte{
// 346 bytes of a gzipped FileDescriptorProto // 326 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x6c, 0x52, 0x4f, 0x4b, 0xfb, 0x40, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x6c, 0x52, 0xcf, 0x4b, 0xc3, 0x30,
0x10, 0xfd, 0xa5, 0x6d, 0x92, 0x76, 0xf2, 0x43, 0xca, 0x22, 0x65, 0xf5, 0x20, 0x25, 0x07, 0xf1, 0x14, 0x76, 0x3f, 0xda, 0x6e, 0xaf, 0x1e, 0x46, 0x90, 0x11, 0x3d, 0xc8, 0xe8, 0xc9, 0x53, 0x07,
0x94, 0x82, 0x82, 0x88, 0x47, 0x51, 0x3c, 0x68, 0x5b, 0x29, 0xfe, 0x01, 0x6f, 0x6b, 0x32, 0x9a, 0x0a, 0x22, 0x1e, 0x45, 0xf1, 0xa0, 0xdb, 0x64, 0x28, 0xc2, 0x6e, 0xb1, 0x7d, 0xb8, 0xa0, 0x4d,
0x45, 0x93, 0x0d, 0xbb, 0xab, 0xd2, 0xab, 0x9f, 0xd6, 0x8f, 0xe1, 0x66, 0x93, 0xb6, 0xa9, 0xf6, 0x4a, 0x12, 0x95, 0xfd, 0xc7, 0xfe, 0x19, 0x26, 0x69, 0xb7, 0x75, 0xb8, 0x43, 0xe1, 0x7d, 0xdf,
0x10, 0x98, 0xf7, 0xde, 0xcc, 0xbc, 0x99, 0xcc, 0xc2, 0x4e, 0xca, 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x20,
0x82, 0x59, 0x33, 0x95, 0x0c, 0xc0, 0xc3, 0xfc, 0xc5, 0xc4, 0xb4, 0x6b, 0x2d, 0x6b, 0x54, 0xee, 0xfd, 0x6a, 0x2f, 0x57, 0x93, 0x6b, 0x38, 0xcc, 0xd7, 0x41, 0x73, 0xbb, 0x1c, 0xfc, 0x6f, 0xb3,
0xc5, 0x63, 0x33, 0x48, 0xaf, 0xda, 0xab, 0x8c, 0xc9, 0x29, 0xfc, 0x4f, 0x16, 0x07, 0xe1, 0x66, 0xfd, 0x11, 0xf3, 0x9d, 0xb3, 0xc9, 0x08, 0xc2, 0xbb, 0xca, 0x39, 0x86, 0xe8, 0x65, 0xfa, 0x30,
0x39, 0xf8, 0x6b, 0xb3, 0x3a, 0xd8, 0x6c, 0x2d, 0x37, 0x1c, 0x82, 0x77, 0x51, 0x75, 0x0e, 0xc0, 0x9d, 0xbd, 0x4e, 0x07, 0x07, 0xa4, 0x0f, 0xc1, 0xfd, 0xec, 0xf9, 0xe9, 0x71, 0xd0, 0xba, 0x89,
0xbf, 0x9b, 0x5c, 0x4d, 0xa6, 0x0f, 0x93, 0xfe, 0x3f, 0xd2, 0x03, 0xf7, 0x72, 0x7a, 0x7b, 0x73, 0x16, 0x81, 0xf7, 0x78, 0x0b, 0xfd, 0xd3, 0xb8, 0xf8, 0x0b, 0x00, 0x00, 0xff, 0xff, 0xb4, 0xec,
0xdd, 0x77, 0xce, 0xfc, 0x47, 0xd7, 0xf6, 0x78, 0xf2, 0xec, 0x1b, 0x3a, 0xfa, 0x09, 0x00, 0x00, 0x4d, 0xaf, 0x37, 0x02, 0x00, 0x00,
0xff, 0xff, 0x6a, 0xfb, 0xe7, 0x86, 0x60, 0x02, 0x00, 0x00,
} }

@ -27,14 +27,11 @@ var _ = math.Inf
const _ = proto.ProtoPackageIsVersion1 const _ = proto.ProtoPackageIsVersion1
type Version struct { type Version struct {
Major uint32 `protobuf:"varint,1,opt,name=major" json:"major,omitempty"` // Sem ver string for the version
Minor uint32 `protobuf:"varint,2,opt,name=minor" json:"minor,omitempty"` SemVer string `protobuf:"bytes,1,opt,name=sem_ver,json=semVer" json:"sem_ver,omitempty"`
Patch uint32 `protobuf:"varint,3,opt,name=patch" json:"patch,omitempty"` GitVersion string `protobuf:"bytes,6,opt,name=git_version,json=gitVersion" json:"git_version,omitempty"`
PreRelease string `protobuf:"bytes,4,opt,name=pre_release,json=preRelease" json:"pre_release,omitempty"` GitCommit string `protobuf:"bytes,7,opt,name=git_commit,json=gitCommit" json:"git_commit,omitempty"`
BuildMetadata string `protobuf:"bytes,5,opt,name=build_metadata,json=buildMetadata" json:"build_metadata,omitempty"` GitTreeState string `protobuf:"bytes,8,opt,name=git_tree_state,json=gitTreeState" json:"git_tree_state,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) Reset() { *m = Version{} }
@ -47,20 +44,16 @@ func init() {
} }
var fileDescriptor0 = []byte{ var fileDescriptor0 = []byte{
// 225 bytes of a gzipped FileDescriptorProto // 161 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x34, 0xd0, 0xb1, 0x4e, 0xc3, 0x30, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x92, 0xca, 0x48, 0x2c, 0xc8,
0x10, 0x06, 0x60, 0x05, 0x68, 0x43, 0x8e, 0xb6, 0x83, 0xc5, 0x60, 0x21, 0x21, 0x10, 0x02, 0x89, 0xd4, 0x2f, 0x4b, 0x2d, 0x2a, 0xce, 0xcc, 0xcf, 0x83, 0xd1, 0x7a, 0x05, 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0xf1, 0xc5, 0x25, 0x89, 0x25, 0xa9, 0x12, 0x1c, 0x60, 0x25, 0x3c,
0xcf, 0x52, 0xd7, 0xf5, 0x90, 0xa8, 0x2f, 0xa2, 0x1e, 0x60, 0xb5, 0xf9, 0xb5, 0x87, 0x9d, 0x71, 0x40, 0xd1, 0x10, 0xa0, 0x60, 0x30, 0x48, 0xcc, 0x89, 0x33, 0x8a, 0x1d, 0x6a, 0x43, 0x12, 0x1b,
0xc4, 0xb8, 0x43, 0x46, 0x3d, 0x93, 0x99, 0xa5, 0xe8, 0x5b, 0xc5, 0xbc, 0xe7, 0xdb, 0xb2, 0xa9, 0xd8, 0xa9, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x68, 0x45, 0xe1, 0x46, 0xc8, 0x00, 0x00,
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, 0x00,
} }

@ -18,8 +18,6 @@ limitations under the License.
package version // import "k8s.io/helm/pkg/version" package version // import "k8s.io/helm/pkg/version"
import ( import (
"fmt"
"k8s.io/helm/pkg/proto/hapi/version" "k8s.io/helm/pkg/proto/hapi/version"
) )
@ -33,35 +31,23 @@ import (
// //
// BuildMetadata gets filled in during build, do not touch // BuildMetadata gets filled in during build, do not touch
// GitCommit gets filled in during build, do not touch // GitCommit gets filled in during build, do not touch
var ( var Version = "v2.0.0-alpha.4"
Major uint32 = 2 var BuildMetadata = ""
Minor uint32 = 0 var GitCommit = ""
Patch uint32 = 0
PreRelease = "alpha.4"
BuildMetadata = ""
GitCommit = ""
)
// GetVersion returns the semver string of the version // GetVersion returns the semver string of the version
func GetVersion() string { func GetVersion() string {
version := fmt.Sprintf("v%d.%d.%d", Major, Minor, Patch) if BuildMetadata == "" {
if PreRelease != "" { return Version
version = version + "-" + PreRelease
}
if BuildMetadata != "" {
version = version + "+" + BuildMetadata
} }
return version return Version + "+" + BuildMetadata
} }
// GetVersionProto returns protobuf representing the version // GetVersionProto returns protobuf representing the version
func GetVersionProto() version.Version { func GetVersionProto() version.Version {
return version.Version{ return version.Version{
Major: Major, SemVer: GetVersion(),
Minor: Minor, GitCommit: GitCommit,
Patch: Patch,
PreRelease: PreRelease,
BuildMetadata: BuildMetadata,
GitCommit: GitCommit,
} }
} }

@ -15,7 +15,7 @@ BINARY_VERSION ?= ${GIT_TAG}-${GIT_SHA}
IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${SHORT_NAME}:${DOCKER_VERSION} IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${SHORT_NAME}:${DOCKER_VERSION}
MUTABLE_IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${SHORT_NAME}:${MUTABLE_VERSION} MUTABLE_IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${SHORT_NAME}:${MUTABLE_VERSION}
LDFLAGS += -X k8s.io/helm/pkg/version.BuildMetadata=${BINARY_VERSION} LDFLAGS += -X k8s.io/helm/pkg/version.BuildMetadata=${GIT_SHA}
LDFLAGS += -X k8s.io/helm/pkg/version.GitCommit=${GIT_COMMIT} LDFLAGS += -X k8s.io/helm/pkg/version.GitCommit=${GIT_COMMIT}
DOCKER_PUSH = docker push DOCKER_PUSH = docker push

Loading…
Cancel
Save