param(webhook): 将企微机器人 key 添加为可配置参数
- 在 Jenkins 构建参数中添加了 webhook 参数,默认值为之前的固定 key
- 修改了 curl 命令,使用 ${params.webhook} 替代硬编码的 key
This commit is contained in:
@@ -3,6 +3,7 @@ pipeline {
|
|||||||
parameters {
|
parameters {
|
||||||
string(name: 'pid', defaultValue: '', description: '定制方案的Id')
|
string(name: 'pid', defaultValue: '', description: '定制方案的Id')
|
||||||
string(name: 'dist', defaultValue: '', description: '部署路径')
|
string(name: 'dist', defaultValue: '', description: '部署路径')
|
||||||
|
string(name: 'webhook', defaultValue: '1e734bc6-ab12-4272-8b15-cf92cb070f5b', description: '企微机器人key')
|
||||||
}
|
}
|
||||||
stages {
|
stages {
|
||||||
stage('拉取代码') {
|
stage('拉取代码') {
|
||||||
@@ -44,7 +45,7 @@ pipeline {
|
|||||||
def currentTime = new Date().format('yyyy-MM-dd HH:mm:ss', TimeZone.getTimeZone('Asia/Shanghai'))
|
def currentTime = new Date().format('yyyy-MM-dd HH:mm:ss', TimeZone.getTimeZone('Asia/Shanghai'))
|
||||||
|
|
||||||
sh """
|
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' \\
|
-H 'Content-Type: application/json' \\
|
||||||
-d '{
|
-d '{
|
||||||
"msgtype": "markdown",
|
"msgtype": "markdown",
|
||||||
|
|||||||
Reference in New Issue
Block a user