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.
 
 
 
 
 
 

70 lines
1.8 KiB

#!/bin/bash
result=$1
job=$2
build_number=$3
branch=$4
platform=$5
user=$6
color="green"
if [ $result = "FAILURE" ];then
color="red"
fi
#判断branch是为空,如果为空,就默认为trunk
if [ -z $branch ];then
branch="trunk"
fi
# user=$(cat ../../jobs/$job/builds/$build_number/log|grep "Started by user"|awk -F "0m" '{print $2}')
# if [ -z $user ];then
# user=$(cat ../../jobs/$job/builds/$build_number/log|grep "Started by"|awk '{print $3}')
# fi
curl -X POST -H "Content-Type: application/json" -d \
'{
"msg_type": "interactive",
"card": {
"elements":
[{
"tag": "div",
"text": {
"content": "构建者:'$user'",
"tag": "lark_md"
}
},
{
"tag": "div",
"text": {
"content": "分支:'$branch' '$platform'",
"tag": "lark_md"
}
},
{
"tag": "markdown",
"content": "<font color='$color'> '$result' </font>"
},
{
"actions": [{
"tag": "button",
"text": {
"content": "点击查看",
"tag": "lark_md"
},
"url": "http://10.0.22.152:8080/job/'$job' ",
"type": "default",
"value": {}
}],
"tag": "action"
}],
"header": {
"title": {
"content": "'$job'",
"tag": "plain_text"
}
}
}
} ' \
https://open.feishu.cn/open-apis/bot/v2/hook/5c637656-4cc9-47cd-ad70-998674c87a88