mirror of
https://github.com/kubernetes-sigs/kind.git
synced 2025-11-30 23:16:04 +07:00
feat: add commit count flag in pre-release version (#2870)
* feat: support commit count in pre-release version * unexport version strings, correct semver and shortern makefile lines * add alpha tag immediately after release commit Co-authored-by: Benjamin Elder <bentheelder@google.com>
This commit is contained in:
6
Makefile
6
Makefile
@@ -27,6 +27,8 @@ REPO_ROOT:=${CURDIR}
|
||||
OUT_DIR=$(REPO_ROOT)/bin
|
||||
# record the source commit in the binary, overridable
|
||||
COMMIT?=$(shell git rev-parse HEAD 2>/dev/null)
|
||||
# count the commits since the last release
|
||||
COMMIT_COUNT?=$(shell git describe --tags | rev | cut -d- -f2 | rev)
|
||||
################################################################################
|
||||
# ========================= Setup Go With Gimme ================================
|
||||
# go version to use for build etc.
|
||||
@@ -54,7 +56,9 @@ KIND_BINARY_NAME?=kind
|
||||
# - reproducible builds: -trimpath and -ldflags=-buildid=
|
||||
# - smaller binaries: -w (trim debugger data, but not panics)
|
||||
# - metadata: -X=... to bake in git commit
|
||||
KIND_BUILD_FLAGS?=-trimpath -ldflags="-buildid= -w -X=sigs.k8s.io/kind/pkg/cmd/kind/version.GitCommit=$(COMMIT)"
|
||||
KIND_VERSION_PKG:=sigs.k8s.io/kind/pkg/cmd/kind/version
|
||||
KIND_BUILD_LD_FLAGS:=-X=$(KIND_VERSION_PKG).gitCommit=$(COMMIT) -X=$(KIND_VERSION_PKG).gitCommitCount=$(COMMIT_COUNT)
|
||||
KIND_BUILD_FLAGS?=-trimpath -ldflags="-buildid= -w $(KIND_BUILD_LD_FLAGS)"
|
||||
################################################################################
|
||||
# ================================= Building ===================================
|
||||
# standard "make" target -> builds
|
||||
|
||||
Reference in New Issue
Block a user