File tree Expand file tree Collapse file tree 4 files changed +19
-7
lines changed Expand file tree Collapse file tree 4 files changed +19
-7
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,9 @@ CMD_SOURCE_DIRS = cmd pkg
83
83
SOURCE_DIRS = $(CMD_SOURCE_DIRS ) test
84
84
SOURCE_PACKAGES = ./cmd/... ./pkg/... ./test/...
85
85
86
+ # kvm2 ldflags
87
+ KVM2_LDFLAGS := -X k8s.io/minikube/pkg/drivers/kvm.version=$(VERSION ) -X k8s.io/minikube/pkg/drivers/kvm.gitCommitID=$(COMMIT )
88
+
86
89
# $(call DOCKER, image, command)
87
90
define DOCKER
88
91
docker run --rm -e GOCACHE=/app/.cache -e IN_DOCKER=1 --user $(shell id -u) :$(shell id -g) -w /app -v $(PWD ) :/app -v $(GOPATH ) :/go --entrypoint /bin/bash $(1 ) -c '$(2 ) '
@@ -387,11 +390,11 @@ release-minikube: out/minikube checksum
387
390
gsutil cp out/minikube-$(GOOS ) -$(GOARCH ) .sha256 $(MINIKUBE_UPLOAD_LOCATION ) /$(MINIKUBE_VERSION ) /minikube-$(GOOS ) -$(GOARCH ) .sha256
388
391
389
392
out/docker-machine-driver-kvm2 :
390
- go build \
391
- -installsuffix " static" \
392
- -ldflags " -X k8s.io/minikube/pkg/drivers/kvm.version= $( VERSION ) " \
393
+ go build \
394
+ -installsuffix " static" \
395
+ -ldflags= " $( KVM2_LDFLAGS ) " \
393
396
-tags libvirt.1.3.1 \
394
- -o $(BUILD_DIR ) /docker-machine-driver-kvm2 \
397
+ -o $(BUILD_DIR ) /docker-machine-driver-kvm2 \
395
398
k8s.io/minikube/cmd/drivers/kvm
396
399
chmod +X $@
397
400
Original file line number Diff line number Diff line change @@ -27,8 +27,9 @@ import (
27
27
)
28
28
29
29
func main () {
30
- if len (os .Args ) > 1 && os .Args [1 ] == "--version" {
31
- fmt .Println (kvm .GetVersion ())
30
+ if len (os .Args ) > 1 && os .Args [1 ] == "version" {
31
+ fmt .Println ("version:" , kvm .GetVersion ())
32
+ fmt .Println ("commit:" , kvm .GetGitCommitID ())
32
33
return
33
34
}
34
35
Original file line number Diff line number Diff line change @@ -99,7 +99,7 @@ virsh net-start default
99
99
Make sure you are running the lastest version of your driver.
100
100
101
101
``` shell
102
- docker-machine-driver-kvm2 -- version
102
+ docker-machine-driver-kvm2 version
103
103
```
104
104
105
105
## Hyperkit driver
Original file line number Diff line number Diff line change @@ -21,7 +21,15 @@ package kvm
21
21
// version is a private field and should be set when compiling with --ldflags="-X k8s.io/minikube/pkg/drivers/kvm.version=vX.Y.Z"
22
22
var version = "v0.0.0-unset"
23
23
24
+ // gitCommitID is a private field and should be set when compiling with --ldflags="-X k8s.io/minikube/pkg/drivers/kvm.gitCommitID=<commit-id>"
25
+ var gitCommitID = ""
26
+
24
27
// GetVersion returns the current docker-machine-driver-kvm2 version
25
28
func GetVersion () string {
26
29
return version
27
30
}
31
+
32
+ // GetGitCommitID returns the git commit id from which it is being built
33
+ func GetGitCommitID () string {
34
+ return gitCommitID
35
+ }
You can’t perform that action at this time.
0 commit comments