diff --git a/CMakeLists.txt b/CMakeLists.txt index 859a4e81b2..199febbb74 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -737,7 +737,7 @@ aux_source_directory(src DIR_SRCS) # # generate version string(TIMESTAMP TS "%Y-%m-%d %H:%M:%S" UTC) -set(PIKA_BUILD_DATE "${TS}" CACHE STRING "the time we first built pika") +set(PIKA_BUILD_DATE "${TS}") find_package(Git) diff --git a/codis/Makefile b/codis/Makefile index c3dd8851d9..7226dfbd8f 100644 --- a/codis/Makefile +++ b/codis/Makefile @@ -2,14 +2,13 @@ export GO111MODULE=on -build-all: codis-dashboard codis-proxy codis-admin codis-ha codis-fe +build-all: codis-dashboard codis-proxy codis-admin codis-ha codis-fe generate-version PRJ_ROOT=${CURDIR} codis-deps: @mkdir -p ./bin && go version - codis-dashboard: codis-deps $(info build codis-dashboard) @cd ${PRJ_ROOT}/cmd/dashboard && go mod tidy && go build -buildvcs=false -o ${PRJ_ROOT}/bin/codis-dashboard . @@ -33,6 +32,10 @@ codis-fe: codis-deps @cd ${PRJ_ROOT}/cmd/fe && go mod tidy && go build -buildvcs=false -o ${PRJ_ROOT}/bin/codis-fe . @rm -rf ${PRJ_ROOT}/bin/assets && cp -rf ${PRJ_ROOT}/cmd/fe/assets ./bin/ +generate-version: + $(info generate version) + @./version + clean: $(info ...Clean Start!) @rm -rf bin diff --git a/tools/pika_exporter/Makefile b/tools/pika_exporter/Makefile index b5178df6e0..7e47d19a8e 100644 --- a/tools/pika_exporter/Makefile +++ b/tools/pika_exporter/Makefile @@ -4,11 +4,7 @@ # export PATH := $(PATH):$(GOPATH)/bin -# for mac -BRANCH := $(shell git branch | sed 's/* \(.*\)/\1/p') -# for Linux -# BRANCH := $(shell git branch | sed --quiet 's/* \(.*\)/\1/p') -GITREV := $(shell git rev-parse --short HEAD) +GITREV := $(shell git rev-parse HEAD) BUILDTIME := $(shell date '+%F %T %Z') COMPILERVERSION := $(subst go version ,,$(shell go version)) PROJNAME := pika_exporter diff --git a/tools/pika_exporter/main.go b/tools/pika_exporter/main.go index 07b4cf5f40..6af84bc4b4 100644 --- a/tools/pika_exporter/main.go +++ b/tools/pika_exporter/main.go @@ -55,7 +55,10 @@ func getEnvInt(key string, defaultVal int) int { func main() { flag.Parse() - log.Println("Pika Metrics Exporter ", BuildVersion, "build date:", BuildDate, "sha:", BuildCommitSha, "go version:", GoVersion) + log.Println("Pika Metrics Exporter") + log.Println("Build Date: ", BuildDate) + log.Println("Commit SHA: ", BuildCommitSha) + log.Println("Go Version: ", GoVersion) if *showVersion { return }