我在Jenkins中使用HTTP请求插件,并使用声明性管道脚本,在该阶段中,我有一个阶段可以调用Microsoft团队传入的Webhook url,并在构建开始时发布消息。我的舞台如下图所示
stage('Build Notification'){
steps{
script{
def payload = '''{
"@type": "MessageCard",
"@context": "http://schema.org/extensions",
"themeColor": "0076D7",
"summary": "Larry Bryant created a new task",
"sections": [{
"activityTitle": "![TestImage](https://47a92947.ngrok.io/Content/Images/default.png)Larry Bryant created a new task",
"activitySubtitle": "On Project Tango",
"activityImage": "https://teamsnodesample.azurewebsites.net/static/img/image5.png",
"facts": [{
"name": "Assigned to",
"value": "Unassigned"
}, {
"name": "Build Number",
"value": "${BUILD_NUMBER}"
}, {
"name": "Status",
"value": "Not started"
}],
"markdown": true
}]
}'''
httpRequest httpMode: 'POST', requestBody: payload, responseHandle: 'NONE' , url: 'blah/blah/blah', wrapAsMultipart: false
}
}
}
我的问题是,当此消息在团队中显示时,“构建状态”实际上显示为$ {BUILD_NUMBER},而不是提供真实的内部版本号。 我试图回显$ {BUILD_NUMBER}及其给出的内部版本号,以证明其有效,但是我无法找出为什么在发送请求时未在http请求的有效载荷内给出的$ {BUILD_NUMBER}替换为真实的内部版本号
我是管道技术的新手,并且在过去的两天里一直坚持下去。请帮忙