发送外壳变量到詹金斯工作中的松弛通知

时间:2019-07-24 06:41:31

标签: jenkins slack

我有一个执行部署的shell脚本。我的shell脚本中设置了一个变量,我想在松弛通知自定义消息中传递该变量,但是它没有按预期工作。

我已经使用envInject插件将shell变量设置为环境变量,并且无法按预期工作

${CRQ} is completed in staging. Please validate
Console url is  : ${BUILD_URL}console 

staging_daily_dose-4.4秒(打开)后失败114 #p>

Console url is  : https://jenkins-host/job/staging_daily_dose/114/console``` 

I want ${CRQ} with the actual value. Can someone help me with the best approach

1 个答案:

答案 0 :(得分:0)

从各种帖子中可以很明显地看出,要添加一个供Slack Notification Plugin使用的环境变量,需要使用注入环境变量来插入,因此

  1. 在“构建”步骤中,创建一个属性文件并编写所需的变量,然后在“注入环境变量插件”中使用该文件

enter image description here

  1. 接下来使用Slack Notification Plugin中的变量 enter image description here

这将导致出现如下所示的松弛消息。 enter image description here