File tree Expand file tree Collapse file tree 10 files changed +50
-26
lines changed Expand file tree Collapse file tree 10 files changed +50
-26
lines changed Original file line number Diff line number Diff line change @@ -736,7 +736,7 @@ endif()
736736aux_source_directory (src DIR_SRCS)
737737
738738# # generate version
739- string (TIMESTAMP TS "%Y-%m-%d %H:%M:%S" UTC )
739+ string (TIMESTAMP TS "%Y-%m-%d %H:%M:%S" )
740740set (PIKA_BUILD_DATE "${TS} " )
741741
742742find_package (Git)
Original file line number Diff line number Diff line change 22
33export GO111MODULE =on
44
5- build-all : codis-dashboard codis-proxy codis-admin codis-ha codis-fe generate-version
5+ build-all : generate-version codis-dashboard codis-proxy codis-admin codis-ha codis-fe
66
77PRJ_ROOT =${CURDIR}
88
9+ generate-version :
10+ $(info generate version)
11+ @mkdir -p ./bin && ./version
912
1013codis-deps :
11- @mkdir -p ./bin && go version
14+ @go version
1215codis-dashboard : codis-deps
1316 $(info build codis-dashboard)
1417 @cd ${PRJ_ROOT} /cmd/dashboard && go mod tidy && go build -buildvcs=false -o ${PRJ_ROOT} /bin/codis-dashboard .
@@ -32,10 +35,6 @@ codis-fe: codis-deps
3235 @cd ${PRJ_ROOT} /cmd/fe && go mod tidy && go build -buildvcs=false -o ${PRJ_ROOT} /bin/codis-fe .
3336 @rm -rf ${PRJ_ROOT} /bin/assets && cp -rf ${PRJ_ROOT} /cmd/fe/assets ./bin/
3437
35- generate-version :
36- $(info generate version)
37- @./version
38-
3938clean :
4039 $(info ...Clean Start!)
4140 @rm -rf bin
Original file line number Diff line number Diff line change @@ -48,8 +48,11 @@ Options:
4848 return
4949
5050 case d ["--version" ].(bool ):
51- fmt .Println ("version:" , utils .Version )
52- fmt .Println ("compile:" , utils .Compile )
51+ fmt .Printf ("-----------Codis Dashboard----------\n " )
52+ fmt .Println ("codis_version:" , utils .Version )
53+ fmt .Println ("codis_git_sha:" , utils .Gitsha )
54+ fmt .Println ("codis_build_compile_date:" , utils .Compile )
55+ fmt .Println ("go version:" , utils .GoVersion )
5356 return
5457
5558 }
Original file line number Diff line number Diff line change @@ -72,8 +72,11 @@ Options:
7272 }
7373
7474 if d ["--version" ].(bool ) {
75- fmt .Println ("version:" , utils .Version )
76- fmt .Println ("compile:" , utils .Compile )
75+ fmt .Printf ("-----------Codis FE----------\n " )
76+ fmt .Println ("codis_version:" , utils .Version )
77+ fmt .Println ("codis_git_sha:" , utils .Gitsha )
78+ fmt .Println ("codis_build_compile_date:" , utils .Compile )
79+ fmt .Println ("go version:" , utils .GoVersion )
7780 return
7881 }
7982
Original file line number Diff line number Diff line change @@ -33,8 +33,11 @@ Options:
3333 }
3434
3535 if d ["--version" ].(bool ) {
36- fmt .Println ("version:" , utils .Version )
37- fmt .Println ("compile:" , utils .Compile )
36+ fmt .Printf ("-----------Codis HA----------\n " )
37+ fmt .Println ("codis_version:" , utils .Version )
38+ fmt .Println ("codis_git_sha:" , utils .Gitsha )
39+ fmt .Println ("codis_build_compile_date:" , utils .Compile )
40+ fmt .Println ("go version:" , utils .GoVersion )
3841 return
3942 }
4043
Original file line number Diff line number Diff line change @@ -55,8 +55,11 @@ Options:
5555 return
5656
5757 case d ["--version" ].(bool ):
58- fmt .Println ("version:" , utils .Version )
59- fmt .Println ("compile:" , utils .Compile )
58+ fmt .Printf ("-----------Codis Proxy----------\n " )
59+ fmt .Println ("codis_version:" , utils .Version )
60+ fmt .Println ("codis_git_sha:" , utils .Gitsha )
61+ fmt .Println ("codis_build_compile_date:" , utils .Compile )
62+ fmt .Println ("go version:" , utils .GoVersion )
6063 return
6164
6265 }
Original file line number Diff line number Diff line change 11package utils
22
33const (
4- Version = "2018-11-04 16:22:35 +0800 @de1ad026e329561c22e2a3035fbfe89dc7fef764 @3.2.2-12-gde1ad026"
5- Compile = "2023-02-23 11:25:09 +0800 by go version go1.19.6 linux/amd64"
4+ Version = "3.5.4"
5+ Gitsha = "61a9b5a6737759459a50684b8c018338ebe5808e"
6+ Compile = "2025-03-21 17:26:57 CST"
7+ GoVersion = "go1.23.4 darwin/amd64"
68)
Original file line number Diff line number Diff line change 11#! /bin/bash
22
3- version=` git log --date=iso --pretty=format:" %cd @%H" -1`
3+ CODIS_MAJOR=3
4+ CODIS_MINOR=5
5+ CODIS_PATCH=4
6+
7+ gitsha=` git log --pretty=format:" %H" -1`
48if [ $? -ne 0 ]; then
5- version =" unknown version "
9+ gitsha =" unknown git log "
610fi
711
8- compile=` date +" %F %T %z " ` " by " ` go version `
12+ compile=` date +" %F %T %Z " `
913if [ $? -ne 0 ]; then
1014 compile=" unknown datetime"
1115fi
1216
13- describe= ` git describe --tags 2> /dev/null `
14- if [ $? -eq 0 ]; then
15- version= " ${version} @ ${describe} "
17+ goversion= $( go version | sed ' s/go version // ' )
18+ if [ $? -ne 0 ]; then
19+ compile= " unknown go version "
1620fi
1721
1822cat << EOF | gofmt > pkg/utils/version.go
1923package utils
2024
2125const (
22- Version = "$version "
26+ Version = "$CODIS_MAJOR .$CODIS_MINOR .$CODIS_PATCH "
27+ Gitsha = "$gitsha "
2328 Compile = "$compile "
29+ GoVersion = "$goversion "
2430)
2531EOF
2632
2733cat << EOF > bin/version
28- version = $version
34+ gitsha = $gitsha
2935compile = $compile
3036EOF
Original file line number Diff line number Diff line change 33# endif
44
55# export PATH := $(PATH):$(GOPATH)/bin
6-
6+ BRANCH := $( shell git branch | sed -n 's/ * \(. * \) /\1/p')
77GITREV := $(shell git rev-parse HEAD)
88BUILDTIME := $(shell date '+% F % T % Z')
99COMPILERVERSION := $(subst go version ,,$(shell go version) )
1010PROJNAME := pika_exporter
11+ PIKA_EXPORTER_MAJOR := 3
12+ PIKA_EXPORTER_MINOR := 5
13+ PIKA_EXPORTER_PATCH := 5
1114
1215define GENERATE_VERSION_CODE
1316cat << EOF | gofmt > version.go
1417package main
1518
1619const (
20+ PikaExporterVersion = "$(PIKA_EXPORTER_MAJOR ) .$(PIKA_EXPORTER_MINOR ) .$(PIKA_EXPORTER_PATCH ) "
1721 BuildVersion = "$(BRANCH ) "
1822 BuildCommitSha = "$(GITREV ) "
1923 BuildDate = "$(BUILDTIME ) "
Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ func main() {
5656 flag .Parse ()
5757
5858 log .Println ("Pika Metrics Exporter" )
59+ log .Println ("Pika Exporter Version: " , PikaExporterVersion )
5960 log .Println ("Build Date: " , BuildDate )
6061 log .Println ("Commit SHA: " , BuildCommitSha )
6162 log .Println ("Go Version: " , GoVersion )
You can’t perform that action at this time.
0 commit comments