jenkins-shared-library/vars/notityFeishu.groovy
2025-02-06 07:27:04 +08:00

15 lines
453 B
Groovy

// 飞书消息推送, 向指定的飞书群发送消息
def call (Map config = [:]) {
def webhook = config.webhook
def title = config.title
def context = config.context
def rawBody = libraryResource 'notify/feishu/post.json'
def binding = [
title: "${title}",
message: "${context}"
]
def render = renderTemplate(rawBody,binding)
sh """
curl -X POST -H \"Content-Type: application/json\" --data \"${render}\" $webhook
"""
}