#!/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": " '$result' " }, { "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": " '$result' " }], "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