mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-09 17:59:36 +08:00
feat: add git author for build info
This commit is contained in:
1
Makefile
1
Makefile
@@ -21,6 +21,7 @@ build: ## build hrp cli tool
|
|||||||
-s -w \
|
-s -w \
|
||||||
-X 'github.com/httprunner/httprunner/v5/internal/version.GitCommit=$(shell git rev-parse HEAD)' \
|
-X 'github.com/httprunner/httprunner/v5/internal/version.GitCommit=$(shell git rev-parse HEAD)' \
|
||||||
-X 'github.com/httprunner/httprunner/v5/internal/version.GitBranch=$(shell git rev-parse --abbrev-ref HEAD)' \
|
-X 'github.com/httprunner/httprunner/v5/internal/version.GitBranch=$(shell git rev-parse --abbrev-ref HEAD)' \
|
||||||
|
-X 'github.com/httprunner/httprunner/v5/internal/version.GitAuthor=$(shell git log -1 --pretty=format:%an)' \
|
||||||
-X 'github.com/httprunner/httprunner/v5/internal/version.BuildTime=$(shell date "+%y%m%d%H%M")'" \
|
-X 'github.com/httprunner/httprunner/v5/internal/version.BuildTime=$(shell date "+%y%m%d%H%M")'" \
|
||||||
-o output/hrp ./cmd/cli
|
-o output/hrp ./cmd/cli
|
||||||
./output/hrp -v
|
./output/hrp -v
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
v5.0.0-beta-2503311054
|
v5.0.0-beta-2503311103
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ var (
|
|||||||
GitCommit = "unknown"
|
GitCommit = "unknown"
|
||||||
GitBranch = "unknown"
|
GitBranch = "unknown"
|
||||||
BuildTime = "unknown"
|
BuildTime = "unknown"
|
||||||
|
GitAuthor = "unknown"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetVersionInfo() string {
|
func GetVersionInfo() string {
|
||||||
@@ -26,6 +27,6 @@ func GetVersionInfo() string {
|
|||||||
if len(commitID) > 8 {
|
if len(commitID) > 8 {
|
||||||
commitID = commitID[:8]
|
commitID = commitID[:8]
|
||||||
}
|
}
|
||||||
return fmt.Sprintf("%s (branch=%s, commit=%s, build=%s)",
|
return fmt.Sprintf("%s (branch=%s, commit=%s, author=%s, build=%s)",
|
||||||
VERSION, GitBranch, commitID, BuildTime)
|
VERSION, GitBranch, commitID, GitAuthor, BuildTime)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user