2016-05-09 20:35:57 +00:00
/ *
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 .
* /
package version
2016-06-09 19:57:21 +00:00
import (
"strings"
"github.com/blang/semver"
)
2019-03-16 13:12:18 +00:00
// VersionPrefix is the prefix of the git tag for a version
2016-06-09 19:57:21 +00:00
const VersionPrefix = "v"
2019-03-02 21:02:56 +00:00
// version is a private field and should be set when compiling with --ldflags="-X k8s.io/minikube/pkg/version.version=vX.Y.Z"
2016-05-28 14:50:36 +00:00
var version = "v0.0.0-unset"
2019-06-28 19:15:05 +00:00
// gitCommitID is a private field and should be set when compiling with --ldflags="-X k8s.io/minikube/pkg/version.gitCommitID=<commit-id>"
2019-06-25 17:12:55 +00:00
var gitCommitID = ""
2019-03-02 21:02:56 +00:00
// isoVersion is a private field and should be set when compiling with --ldflags="-X k8s.io/minikube/pkg/version.isoVersion=vX.Y.Z"
2017-02-03 19:59:40 +00:00
var isoVersion = "v0.0.0-unset"
2020-08-03 17:48:09 +00:00
// storageProvisionerVersion is a private field and should be set when compiling with --ldflags="-X k8s.io/minikube/pkg/version.storageProvisionerVersion=<storage-provisioner-version>"
var storageProvisionerVersion = ""
2019-03-16 13:12:18 +00:00
// GetVersion returns the current minikube version
2016-05-28 14:50:36 +00:00
func GetVersion ( ) string {
return version
}
2016-06-09 19:57:21 +00:00
2019-06-25 17:12:55 +00:00
// GetGitCommitID returns the git commit id from which it is being built
func GetGitCommitID ( ) string {
return gitCommitID
}
2019-03-16 13:12:18 +00:00
// GetISOVersion returns the current minikube.iso version
2019-03-02 21:02:56 +00:00
func GetISOVersion ( ) string {
2017-02-03 19:59:40 +00:00
return isoVersion
}
2019-03-16 13:12:18 +00:00
// GetSemverVersion returns the current minikube semantic version (semver)
2016-06-09 19:57:21 +00:00
func GetSemverVersion ( ) ( semver . Version , error ) {
return semver . Make ( strings . TrimPrefix ( GetVersion ( ) , VersionPrefix ) )
}
2020-08-03 17:48:09 +00:00
// GetStorageProvisionerVersion returns the storage provisioner version
func GetStorageProvisionerVersion ( ) string {
return storageProvisionerVersion
}