Skip to content

Commit 840e7a1

Browse files
authored
'make build' injects git commit as kpt version (#3085)
1 parent 9a8998a commit 840e7a1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
.PHONY: docs license fix vet fmt lint test build tidy
1616

1717
GOBIN := $(shell go env GOPATH)/bin
18+
GIT_COMMIT := $(shell git rev-parse --short HEAD)
1819

1920
# T refers to an e2e test case matcher. This enables running e2e tests
2021
# selectively. For example,
@@ -27,7 +28,7 @@ T ?= ".*"
2728
all: generate license fix vet fmt lint license-check test build buildall tidy
2829

2930
build:
30-
go build -o $(GOBIN)/kpt -v .
31+
go build -ldflags "-X github.com/GoogleContainerTools/kpt/run.version=${GIT_COMMIT}" -o $(GOBIN)/kpt -v .
3132

3233
buildall:
3334
GOOS=windows go build -o /dev/null

0 commit comments

Comments
 (0)