Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 305292f

Browse filesBrowse files
committed
Initial commit
0 parents  commit 305292f
Copy full SHA for 305292f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree

46 files changed

+970
-0
lines changed

‎.gitattributes

Copy file name to clipboard
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* linguist-language=GO

‎.gitignore

Copy file name to clipboard
+18Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
.buildpath
2+
.hgignore.swp
3+
.project
4+
.orig
5+
.swp
6+
.idea/
7+
.settings/
8+
.vscode/
9+
bin/
10+
**/.DS_Store
11+
gf
12+
main
13+
main.exe
14+
output/
15+
manifest/output/
16+
temp/
17+
temp.yaml
18+
bin

‎Dockerfile

Copy file name to clipboard
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM loads/alpine:3.8
2+
3+
###############################################################################
4+
# INSTALLATION
5+
###############################################################################
6+
WORKDIR /app
7+
8+
ADD ./temp/linux_amd64/notifier .
9+
RUN chmod +x notifier
10+
11+
###############################################################################
12+
# START
13+
###############################################################################
14+
EXPOSE 8080
15+
16+
CMD ./notifier

‎LICENSE

Copy file name to clipboard
+21Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 lingcoder
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

‎Makefile

Copy file name to clipboard
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
ROOT_DIR = $(shell pwd)
2+
NAMESPACE = "default"
3+
DEPLOY_NAME = "prometheus-notifier"
4+
DOCKER_NAME = "prometheus-notifier"
5+
PREFIX = "lingcoder"
6+
7+
include ./hack/hack.mk
8+
9+
.PHONY: build-image
10+
11+
build-image:
12+
docker build -t $(PREFIX)/$(DOCKER_NAME) .

‎README.md

Copy file name to clipboard
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# prometheus-notifier
2+
3+
<div align=center>
4+
<img src="https://img.shields.io/badge/golang-^1.21-red"/>
5+
<img src="https://img.shields.io/badge/grafana-^10-green"/>
6+
<img src="https://img.shields.io/badge/alertmanager-^0.26-blue"/>
7+
</div>
8+
9+
### 已支持的通知方式
10+
11+
- [x] feishu 飞书群组机器人

‎api/v1/base.go

Copy file name to clipboard
+45Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package v1
2+
3+
import (
4+
"time"
5+
)
6+
7+
type BaseReq struct {
8+
Lang string `json:"lang"`
9+
URL string `json:"url"`
10+
}
11+
12+
// Message defines the JSON object send to webhook endpoints.
13+
type Message struct {
14+
*Data
15+
16+
// The protocol version.
17+
Version string `json:"version"`
18+
GroupKey string `json:"groupKey"`
19+
TruncatedAlerts uint64 `json:"truncatedAlerts"`
20+
}
21+
22+
type Data struct {
23+
Receiver string `json:"receiver"`
24+
Status string `json:"status"`
25+
Alerts []Alert `json:"alerts"`
26+
27+
GroupLabels map[string]string `json:"groupLabels"`
28+
CommonLabels map[string]string `json:"commonLabels"`
29+
CommonAnnotations map[string]string `json:"commonAnnotations"`
30+
31+
ExternalURL string `json:"externalURL"`
32+
}
33+
34+
type Alert struct {
35+
Status string `json:"status"`
36+
Labels map[string]string `json:"labels"`
37+
Annotations map[string]string `json:"annotations"`
38+
StartsAt time.Time `json:"startsAt"`
39+
EndsAt time.Time `json:"endsAt"`
40+
GeneratorURL string `json:"generatorURL"`
41+
Fingerprint string `json:"fingerprint"`
42+
}
43+
44+
type BaseRes struct {
45+
}

‎api/v1/custom.go

Copy file name to clipboard
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package v1
2+
3+
type CustomReq struct {
4+
BaseReq
5+
Body Message
6+
}

‎api/v1/feishu.go

Copy file name to clipboard
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package v1
2+
3+
type FeishuReq struct {
4+
BaseReq
5+
Body Message
6+
}

‎api/v1/index.go

Copy file name to clipboard
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package v1
2+
3+
type WelcomeReq struct {
4+
}
5+
6+
type WelcomeRes struct {
7+
}

‎config/config.yaml

Copy file name to clipboard
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
server:
2+
address: ":8082"
3+
# openapiPath: "/api.json"
4+
# swaggerPath: "/swagger"
5+
6+
logger:
7+
level : "all"
8+
stdout: true
9+
10+
11+

‎go.mod

Copy file name to clipboard
+34Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
module github.com/lingcoder/prometheus-notifier
2+
3+
go 1.21
4+
5+
require github.com/gogf/gf/v2 v2.5.5
6+
7+
require (
8+
github.com/BurntSushi/toml v1.3.2 // indirect
9+
github.com/clbanning/mxj/v2 v2.7.0 // indirect
10+
github.com/fatih/color v1.15.0 // indirect
11+
github.com/fsnotify/fsnotify v1.6.0 // indirect
12+
github.com/go-logr/logr v1.2.4 // indirect
13+
github.com/go-logr/stdr v1.2.2 // indirect
14+
github.com/gorilla/websocket v1.5.0 // indirect
15+
github.com/grokify/html-strip-tags-go v0.0.1 // indirect
16+
github.com/kr/pretty v0.3.1 // indirect
17+
github.com/larksuite/oapi-sdk-go/v3 v3.0.30 // indirect
18+
github.com/magiconair/properties v1.8.7 // indirect
19+
github.com/mattn/go-colorable v0.1.13 // indirect
20+
github.com/mattn/go-isatty v0.0.20 // indirect
21+
github.com/mattn/go-runewidth v0.0.15 // indirect
22+
github.com/olekukonko/tablewriter v0.0.5 // indirect
23+
github.com/rivo/uniseg v0.4.4 // indirect
24+
github.com/rogpeppe/go-internal v1.10.0 // indirect
25+
go.opentelemetry.io/otel v1.19.0 // indirect
26+
go.opentelemetry.io/otel/metric v1.19.0 // indirect
27+
go.opentelemetry.io/otel/sdk v1.19.0 // indirect
28+
go.opentelemetry.io/otel/trace v1.19.0 // indirect
29+
golang.org/x/net v0.17.0 // indirect
30+
golang.org/x/sys v0.13.0 // indirect
31+
golang.org/x/text v0.13.0 // indirect
32+
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
33+
gopkg.in/yaml.v3 v3.0.1 // indirect
34+
)

‎go.sum

Copy file name to clipboard
+78Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8=
2+
github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
3+
github.com/clbanning/mxj/v2 v2.7.0 h1:WA/La7UGCanFe5NpHF0Q3DNtnCsVoxbPKuyBNHWRyME=
4+
github.com/clbanning/mxj/v2 v2.7.0/go.mod h1:hNiWqW14h+kc+MdF9C6/YoRfjEJoR3ou6tn/Qo+ve2s=
5+
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
6+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
7+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
8+
github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs=
9+
github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw=
10+
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
11+
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
12+
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
13+
github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ=
14+
github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
15+
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
16+
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
17+
github.com/gogf/gf/v2 v2.5.5 h1:av3xMltrJiZWs4lW5KUTTDh45qg3wUV33W5OebE+pYo=
18+
github.com/gogf/gf/v2 v2.5.5/go.mod h1:17K/gBYrp0bHGC3XYC7bSPoywmZ6MrZHrZakTfh4eIQ=
19+
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
20+
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
21+
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
22+
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
23+
github.com/grokify/html-strip-tags-go v0.0.1 h1:0fThFwLbW7P/kOiTBs03FsJSV9RM2M/Q/MOnCQxKMo0=
24+
github.com/grokify/html-strip-tags-go v0.0.1/go.mod h1:2Su6romC5/1VXOQMaWL2yb618ARB8iVo6/DR99A6d78=
25+
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
26+
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
27+
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
28+
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
29+
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
30+
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
31+
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
32+
github.com/larksuite/oapi-sdk-go/v3 v3.0.30 h1:pMnTSpSGdqTxept5cz6qc9wroH8Ac1VY5nRrQ0FjVLs=
33+
github.com/larksuite/oapi-sdk-go/v3 v3.0.30/go.mod h1:FKi8vBgtkBt/xNRQUwdWvoDmsPh7/wP75Sn5IBIBQLk=
34+
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
35+
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
36+
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
37+
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
38+
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
39+
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
40+
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
41+
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
42+
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
43+
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
44+
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
45+
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
46+
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
47+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
48+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
49+
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
50+
github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis=
51+
github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
52+
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
53+
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
54+
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
55+
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
56+
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
57+
go.opentelemetry.io/otel v1.19.0 h1:MuS/TNf4/j4IXsZuJegVzI1cwut7Qc00344rgH7p8bs=
58+
go.opentelemetry.io/otel v1.19.0/go.mod h1:i0QyjOq3UPoTzff0PJB2N66fb4S0+rSbSB15/oyH9fY=
59+
go.opentelemetry.io/otel/metric v1.19.0 h1:aTzpGtV0ar9wlV4Sna9sdJyII5jTVJEvKETPiOKwvpE=
60+
go.opentelemetry.io/otel/metric v1.19.0/go.mod h1:L5rUsV9kM1IxCj1MmSdS+JQAcVm319EUrDVLrt7jqt8=
61+
go.opentelemetry.io/otel/sdk v1.19.0 h1:6USY6zH+L8uMH8L3t1enZPR3WFEmSTADlqldyHtJi3o=
62+
go.opentelemetry.io/otel/sdk v1.19.0/go.mod h1:NedEbbS4w3C6zElbLdPJKOpJQOrGUJ+GfzpjUvI0v1A=
63+
go.opentelemetry.io/otel/trace v1.19.0 h1:DFVQmlVbfVeOuBRrwdtaehRrWiL1JoVs9CPIQ1Dzxpg=
64+
go.opentelemetry.io/otel/trace v1.19.0/go.mod h1:mfaSyvGyEJEI0nyV2I4qhNQnbBOUUmYZpYojqMnX2vo=
65+
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
66+
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
67+
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
68+
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
69+
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
70+
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
71+
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
72+
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
73+
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
74+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
75+
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
76+
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
77+
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
78+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

‎hack/config.yaml

Copy file name to clipboard
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# CLI tool, only in development environment.
2+
# https://goframe.org/pages/viewpage.action?pageId=3673173
3+
gfcli:
4+
build:
5+
name: "notifier"
6+
arch: "amd64"
7+
system: "linux,darwin,windows"
8+
mod: ""
9+
cgo: 0
10+
packSrc: "i18n,config"
11+
12+
docker:
13+
tagName: "prometheus-notifier:latest"
14+
# tagPrefixes:
15+
# -
16+

‎hack/hack-cli.mk

Copy file name to clipboard
+19Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
# Install/Update to the latest CLI tool.
3+
.PHONY: cli
4+
cli:
5+
@set -e; \
6+
wget -O gf https://github.com/gogf/gf/releases/latest/download/gf_$(shell go env GOOS)_$(shell go env GOARCH) && \
7+
chmod +x gf && \
8+
./gf install -y && \
9+
rm ./gf
10+
11+
12+
# Check and install CLI tool.
13+
.PHONY: cli.install
14+
cli.install:
15+
@set -e; \
16+
gf -v > /dev/null 2>&1 || if [[ "$?" -ne "0" ]]; then \
17+
echo "GoFame CLI is not installed, start proceeding auto installation..."; \
18+
make cli; \
19+
fi;

‎hack/hack.mk

Copy file name to clipboard
+75Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
include ./hack/hack-cli.mk
2+
3+
# Update GoFrame and its CLI to latest stable version.
4+
.PHONY: up
5+
up: cli.install
6+
@gf up -a
7+
8+
# Build binary using configuration from hack/config.yaml.
9+
.PHONY: build
10+
build: cli.install
11+
@gf build -ew
12+
13+
# Parse api and generate controller/sdk.
14+
.PHONY: ctrl
15+
ctrl: cli.install
16+
@gf gen ctrl
17+
18+
# Generate Go files for DAO/DO/Entity.
19+
.PHONY: dao
20+
dao: cli.install
21+
@gf gen dao
22+
23+
# Parse current project go files and generate enums go file.
24+
.PHONY: enums
25+
enums: cli.install
26+
@gf gen enums
27+
28+
# Generate Go files for Service.
29+
.PHONY: service
30+
service: cli.install
31+
@gf gen service
32+
33+
34+
# Build docker image.
35+
.PHONY: image
36+
image: cli.install
37+
$(eval _TAG = $(shell git describe --dirty --always --tags --abbrev=8 --match 'v*' | sed 's/-/./2' | sed 's/-/./2'))
38+
ifneq (, $(shell git status --porcelain 2>/dev/null))
39+
$(eval _TAG = $(_TAG).dirty)
40+
endif
41+
$(eval _TAG = $(if ${TAG}, ${TAG}, $(_TAG)))
42+
$(eval _PUSH = $(if ${PUSH}, ${PUSH}, ))
43+
@gf docker ${_PUSH} -tn $(DOCKER_NAME):${_TAG};
44+
45+
46+
# Build docker image and automatically push to docker repo.
47+
.PHONY: image.push
48+
image.push:
49+
@make image PUSH=-p;
50+
51+
52+
# Deploy image and yaml to current kubectl environment.
53+
.PHONY: deploy
54+
deploy:
55+
$(eval _TAG = $(if ${TAG}, ${TAG}, develop))
56+
57+
@set -e; \
58+
mkdir -p $(ROOT_DIR)/temp/kustomize;\
59+
cd $(ROOT_DIR)/manifest/deploy/kustomize/overlays/${_ENV};\
60+
kustomize build > $(ROOT_DIR)/temp/kustomize.yaml;\
61+
kubectl apply -f $(ROOT_DIR)/temp/kustomize.yaml; \
62+
if [ $(DEPLOY_NAME) != "" ]; then \
63+
kubectl patch -n $(NAMESPACE) deployment/$(DEPLOY_NAME) -p "{\"spec\":{\"template\":{\"metadata\":{\"labels\":{\"date\":\"$(shell date +%s)\"}}}}}"; \
64+
fi;
65+
66+
67+
# Parsing protobuf files and generating go files.
68+
.PHONY: pb
69+
pb: cli.install
70+
@gf gen pb
71+
72+
# Generate protobuf files for database tables.
73+
.PHONY: pbentity
74+
pbentity: cli.install
75+
@gf gen pbentity

‎i18n/en/alert_template.json

Copy file name to clipboard
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"feishu-template": "Level: S{{.Severity}} {{if .IsRecovered}}Recovered{{else}}Triggered{{end}}\nRule name: {{.RuleName}}{{if .RuleNote}}\nRule remark: {{.RuleNote}}{{end}}\nMetric labels: {{.TagsJSON}}\n{{if .IsRecovered}}Recover time:{{ .LastEvalTime}}{{else}}Trigger time: {{ .TriggerTime}}\nTrigger value: {{.TriggerValue}}{{end}}\nSent time: {{.timestamp}}",
3+
"feishu-title": "Alert Notification"
4+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.