chore: use git commit hash instead of version in sentry
This commit is contained in:
parent
8fc7181bec
commit
085202c174
4
Makefile
4
Makefile
@ -2,10 +2,12 @@ GO := go
|
||||
|
||||
PKG_BASE := $(shell head -n 1 go.mod | awk '{print $$2}')
|
||||
BUILD_TIME := $(shell date -u '+%Y%m%d-%I%M%S')
|
||||
VERSION := $(shell cat VERSION)+$(shell git rev-parse --short HEAD)
|
||||
VERSION := $(shell cat VERSION)
|
||||
GIT_COMMIT := $(shell git rev-parse HEAD)
|
||||
|
||||
LDFLAGS += -X $(PKG_BASE)/cmd.BuildTime=$(BUILD_TIME)
|
||||
LDFLAGS += -X $(PKG_BASE)/cmd.Version=$(VERSION)
|
||||
LDFLAGS += -X $(PKG_BASE)/cmd.GitCommit=$(GIT_COMMIT)
|
||||
LDFLAGS += -X $(PKG_BASE)/cmd.SentryDSN=$(shell cat dsn.txt)
|
||||
LDFLAGS += -s -w
|
||||
|
||||
|
@ -39,20 +39,26 @@ var App = &cli.App{
|
||||
var (
|
||||
BuildTime string
|
||||
Version string
|
||||
GitCommit string
|
||||
SentryDSN string
|
||||
)
|
||||
|
||||
func init() {
|
||||
if BuildTime == "" {
|
||||
BuildTime = "2022-09-06-01-00-00"
|
||||
// First Commit
|
||||
BuildTime = "20220907-153437"
|
||||
}
|
||||
App.Compiled = getBuildTime()
|
||||
|
||||
if Version == "" {
|
||||
Version = "0.0.0+None"
|
||||
Version = "0.0.0"
|
||||
}
|
||||
App.Version = Version
|
||||
|
||||
if GitCommit == "" {
|
||||
GitCommit = "out-of-tree"
|
||||
}
|
||||
|
||||
if SentryDSN != "" {
|
||||
setupSentry()
|
||||
}
|
||||
@ -73,7 +79,7 @@ func setupSentry() {
|
||||
EnableTracing: true,
|
||||
TracesSampleRate: 1.0,
|
||||
SendDefaultPII: true,
|
||||
Release: Version,
|
||||
Release: GitCommit,
|
||||
})
|
||||
if err != nil {
|
||||
log.Fatalf("sentry.Init: %s", err)
|
||||
|
Loading…
Reference in New Issue
Block a user