github.com/cloudposse/helm@v2.2.3+incompatible/pkg/version/version.go (about)

     1  /*
     2  Copyright 2016 The Kubernetes Authors All rights reserved.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package version // import "k8s.io/helm/pkg/version"
    18  
    19  import "k8s.io/helm/pkg/proto/hapi/version"
    20  
    21  var (
    22  	// Version is the current version of the Helm.
    23  	// Update this whenever making a new release.
    24  	// The version is of the format Major.Minor.Patch[-Prerelease][+BuildMetadata]
    25  	//
    26  	// Increment major number for new feature additions and behavioral changes.
    27  	// Increment minor number for bug fixes and performance enhancements.
    28  	// Increment patch number for critical fixes to existing releases.
    29  	Version = "v2.2.3"
    30  
    31  	// BuildMetadata is extra build time data
    32  	BuildMetadata = ""
    33  	// GitCommit is the git sha1
    34  	GitCommit = ""
    35  	// GitTreeState is the state of the git tree
    36  	GitTreeState = ""
    37  )
    38  
    39  // GetVersion returns the semver string of the version
    40  func GetVersion() string {
    41  	if BuildMetadata == "" {
    42  		return Version
    43  	}
    44  	return Version + "+" + BuildMetadata
    45  }
    46  
    47  // GetVersionProto returns protobuf representing the version
    48  func GetVersionProto() *version.Version {
    49  	return &version.Version{
    50  		SemVer:       GetVersion(),
    51  		GitCommit:    GitCommit,
    52  		GitTreeState: GitTreeState,
    53  	}
    54  }