From 2777fa5abeb7ff6d9e17fd83c0f4ed44aabe47b6 Mon Sep 17 00:00:00 2001 From: aixianling Date: Wed, 15 Jan 2025 11:36:53 +0800 Subject: [PATCH] =?UTF-8?q?param(webhook):=20=E5=B0=86=E4=BC=81=E5=BE=AE?= =?UTF-8?q?=E6=9C=BA=E5=99=A8=E4=BA=BA=20key=20=E6=B7=BB=E5=8A=A0=E4=B8=BA?= =?UTF-8?q?=E5=8F=AF=E9=85=8D=E7=BD=AE=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 Jenkins 构建参数中添加了 webhook 参数,默认值为之前的固定 key - 修改了 curl 命令,使用 ${params.webhook} 替代硬编码的 key --- web_jenkins | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/web_jenkins b/web_jenkins index bc29bf8..55b0a19 100644 --- a/web_jenkins +++ b/web_jenkins @@ -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",