param(webhook): 将企微机器人 key 添加为可配置参数

- 在 Jenkins 构建参数中添加了 webhook 参数,默认值为之前的固定 key
- 修改了 curl 命令,使用 ${params.webhook} 替代硬编码的 key
This commit is contained in:
aixianling
2025-01-15 11:36:53 +08:00
parent e6e997c647
commit 2777fa5abe

View File

@@ -3,6 +3,7 @@ pipeline {
parameters {
string(name: 'pid', defaultValue: '', description: '定制方案的Id')
string(name: 'dist', defaultValue: '', description: '部署路径')
string(name: 'webhook', defaultValue: '1e734bc6-ab12-4272-8b15-cf92cb070f5b', description: '企微机器人key')
}
stages {
stage('拉取代码') {
@@ -44,7 +45,7 @@ pipeline {
def currentTime = new Date().format('yyyy-MM-dd HH:mm:ss', TimeZone.getTimeZone('Asia/Shanghai'))
sh """
curl 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=1e734bc6-ab12-4272-8b15-cf92cb070f5b' \\
curl 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=${params.webhook}' \\
-H 'Content-Type: application/json' \\
-d '{
"msgtype": "markdown",