如何post about build start into slack?

How to post about build start into slack?

如果我有 Jenkins 版本,我可以在 jenkins flow dsl 中使用 slackSend 命令吗? 1.656。 我启用了 Slack Notification Plugin,它在大多数情况下都能正常工作,但我希望在构建开始时显示消息。

你可以在管道中设置脚本,应该是这样的:

def notify(status) {
    slackSend channel: "#jenkins", 
    color: '#d71f85',
    message: "${status}", 
    tokenCredentialId: 'yourtoken'
}

pipeline{
 ....
 stages{
    stage('Buildstart) {
      steps {
        notify("Build Started")
      }
    }
   ....
 }
}