You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
105 lines
2.5 KiB
105 lines
2.5 KiB
1 month ago
|
#!/bin/bash
|
||
|
|
||
|
user=$1
|
||
|
branch=$2
|
||
|
result=$3
|
||
|
title=$4
|
||
|
build_file_name=$5
|
||
|
subpath=$6
|
||
|
feshu_url=$7
|
||
|
image_url=$8
|
||
|
|
||
|
color="green"
|
||
|
if [ $result = "FAILURE" ];then
|
||
|
color="red"
|
||
|
fi
|
||
|
|
||
|
function successNotice() {
|
||
|
curl -X POST -H "Content-Type: application/json" -d \
|
||
|
'{
|
||
|
"msg_type": "interactive",
|
||
|
"card": {
|
||
|
"elements":
|
||
|
[{
|
||
|
"tag": "div",
|
||
|
"text": {
|
||
|
"content": "build-user: '$user' ",
|
||
|
"tag": "lark_md"
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"tag": "div",
|
||
|
"text": {
|
||
|
"content": "build-branch: '$branch' ",
|
||
|
"tag": "lark_md"
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"tag": "markdown",
|
||
|
"content": "<font color='$color'> '$result' </font>"
|
||
|
},
|
||
|
{
|
||
|
"actions": [{
|
||
|
"tag": "button",
|
||
|
"text": {
|
||
|
"content": "'$build_file_name'",
|
||
|
"tag": "lark_md"
|
||
|
},
|
||
|
"url": "http://10.0.23.47:7980/'$subpath'/'$build_file_name'",
|
||
|
"type": "default",
|
||
|
"value": {}
|
||
|
}],
|
||
|
"tag": "action"
|
||
|
}],
|
||
|
"header": {
|
||
|
"title": {
|
||
|
"content": "'$title' ",
|
||
|
"tag": "plain_text"
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
} ' \
|
||
|
https://open.feishu.cn/open-apis/bot/v2/hook/$feshu_url
|
||
|
|
||
|
}
|
||
|
function failureNotice() {
|
||
|
curl -X POST -H "Content-Type: application/json" -d \
|
||
|
'{
|
||
|
"msg_type": "interactive",
|
||
|
"card": {
|
||
|
"elements":
|
||
|
[{
|
||
|
"tag": "div",
|
||
|
"text": {
|
||
|
"content": "build-user: '$user'",
|
||
|
"tag": "lark_md"
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"tag": "div",
|
||
|
"text": {
|
||
|
"content": "build-branch: '$branch' ",
|
||
|
"tag": "lark_md"
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"tag": "markdown",
|
||
|
"content": "<font color='$color'> '$result' </font>"
|
||
|
}],
|
||
|
"header": {
|
||
|
"title": {
|
||
|
"content": "'$title' ",
|
||
|
"tag": "plain_text"
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
} ' \
|
||
|
https://open.feishu.cn/open-apis/bot/v2/hook/$feshu_url
|
||
|
}
|
||
|
|
||
|
|
||
|
if [ $result = "FAILURE" ]; then
|
||
|
failureNotice
|
||
|
else
|
||
|
successNotice
|
||
|
fi
|