File tree Expand file tree Collapse file tree 5 files changed +13
-8
lines changed
Expand file tree Collapse file tree 5 files changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ builds:
2828 - arm64
2929 ldflags :
3030 - -s -w
31+ - -X github.com/megaease/easeprobe/global.Ver={{ .Tag }}
3132 - -X github.com/megaease/easeprobe/pkg/version.RELEASE={{ .Tag }}
3233 - -X github.com/megaease/easeprobe/pkg/version.COMMIT={{.Commit}}
3334 - -X github.com/megaease/easeprobe/pkg/version.REPO=megaease/easeprobe
Original file line number Diff line number Diff line change @@ -9,7 +9,10 @@ MKFILE_DIR := $(dir $(MKFILE_PATH))
99RELEASE_DIR := ${MKFILE_DIR}/build/bin
1010
1111# Version
12- RELEASE? =v0.1.0
12+ RELEASE_VER := $(shell git describe --tag --abbrev=0)
13+
14+ # Go MOD
15+ GO_MOD := $(shell go list -m)
1316
1417# Git Related
1518GIT_REPO_INFO =$(shell cd ${MKFILE_DIR} && git config --get remote.origin.url)
@@ -27,7 +30,7 @@ all: ${TARGET}
2730${TARGET} : ${SOURCE}
2831 mkdir -p ${RELEASE_DIR}
2932 go mod tidy
30- CGO_ENABLED=0 go build -a -ldflags ' -s -w -extldflags " -static" ' -o ${TARGET} github.com/megaease/easeprobe /cmd/easeprobe
33+ CGO_ENABLED=0 go build -a -ldflags " -s -w -extldflags -static -X ${GO_MOD} /global.Ver= ${RELEASE_VER} " -o ${TARGET} ${GO_MOD} /cmd/easeprobe
3134
3235build : all
3336
Original file line number Diff line number Diff line change @@ -37,16 +37,19 @@ const (
3737 Org = "MegaEase"
3838 // DefaultProg is the program name
3939 DefaultProg = "EaseProbe"
40+ // DefaultIconURL is the default icon which used in Slack or Discord
41+ DefaultIconURL = "https://megaease.com/favicon.png"
42+ )
43+
44+ var (
4045 // Ver is the program version
46+ // It will be set by the build script
47+ // go build -ldflags "-X github.com/megaease/easegress/pkg/global.Ver=1.0.0"
4148 Ver = "v1.7.0"
42-
4349 //OrgProg combine organization and program
4450 OrgProg = Org + " " + DefaultProg
4551 //OrgProgVer combine organization and program and version
4652 OrgProgVer = Org + " " + DefaultProg + "/" + Ver
47-
48- // DefaultIconURL is the default icon which used in Slack or Discord
49- DefaultIconURL = "https://megaease.com/favicon.png"
5053)
5154
5255const (
Original file line number Diff line number Diff line change @@ -162,7 +162,6 @@ func ToSlack(r probe.Result) string {
162162
163163 json := `
164164 {
165- "channel": "Alert",
166165 "text": "%s",
167166 "blocks": [
168167 {
Original file line number Diff line number Diff line change @@ -277,7 +277,6 @@ func SLASlackSection(r *probe.Result) string {
277277func SLASlack (probers []probe.Prober ) string {
278278 summary := SLASummary (probers )
279279 json := `{
280- "channel": "Report",
281280 "text": "Overall SLA Report - ` + summary + ` ",
282281 "blocks": [
283282 {
You can’t perform that action at this time.
0 commit comments