fix: clean Jenkinsfile (single-quote sh blocks)
This commit is contained in:
parent
add33f2740
commit
1fa0b85ad8
9
Jenkinsfile
vendored
9
Jenkinsfile
vendored
@ -25,9 +25,16 @@ def feishuNotify = { String result, String failedStageName = "" ->
|
||||
if (burl == null) { burl = "http://115.191.51.246:8080/job/" + env.JOB_NAME.replace("/", "/job/") + "/" }
|
||||
elements.add([tag: "action", actions: [[tag: "button", text: [tag: "plain_text", content: "查看构建"], url: burl, type: isOk ? "primary" : "danger"]]])
|
||||
def card = [msg_type: "interactive", card: [header: [title: [tag: "plain_text", content: title], template: color], elements: elements]]
|
||||
def ts = String.valueOf(System.currentTimeMillis() / 1000L as long)
|
||||
def stringToSign = ts + "\n" + "Qp6SwLIkgRJEtV9UsOf6mg"
|
||||
def mac = javax.crypto.Mac.getInstance("HmacSHA256")
|
||||
mac.init(new javax.crypto.spec.SecretKeySpec(stringToSign.getBytes("UTF-8"), "HmacSHA256"))
|
||||
def sign = mac.doFinal().encodeBase64().toString()
|
||||
card.timestamp = ts
|
||||
card.sign = sign
|
||||
def jsonStr = groovy.json.JsonOutput.toJson(card)
|
||||
writeFile file: "/tmp/feishu_msg.json", text: jsonStr
|
||||
sh 'curl -sS -X POST https://open.feishu.cn/open-apis/bot/v2/hook/d215e8ed-edea-4f07-a77c-2a0e5b52d9b9 -H "Content-Type: application/json" -d @/tmp/feishu_msg.json || true'
|
||||
sh 'curl -sS -X POST https://open.feishu.cn/open-apis/bot/v2/hook/921d9874-de0a-4eca-9ca6-66bf91bd2fbc -H "Content-Type: application/json" -d @/tmp/feishu_msg.json || true'
|
||||
sh 'rm -f /tmp/feishu_msg.json'
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user