是否可以在slackSend()功能Jenkins声明式管道中发送(thread_ts)一样的属性?

时间:2019-01-18 10:35:50

标签: jenkins slack-api slack-commands

我想将Jenkins响应作为线程发送给Slack。有可能..?

slackSend(频道:“构建”,消息:“开始构建”,thread_ts:如何?)

2 个答案:

答案 0 :(得分:0)

node {
    def slackResponse = slackSend(channel: "cool-threads", message: "Here is the primary message")
    slackSend(channel: slackResponse.threadId, message: "Thread reply #1")
    slackSend(channel: slackResponse.threadId, message: "Thread reply #2")
}

回复广播到频道消息

node {
    def slackResponse = slackSend(channel: "ci", message: "Started build")
    slackSend(channel: slackResponse.threadId, message: "Build still in progress")
    slackSend(
        channel: slackResponse.threadId,
        replyBroadcast: true,
        message: "Build failed. Broadcast to channel for better visibility."
    )
}

更多信息可以在官方文档中找到 https://github.com/jenkinsci/slack-plugin

答案 1 :(得分:0)

根据this文章,必须启用漫游器用户模式。将bot-user:true添加到slacksend命令将完成此操作,但是随后我得到了一个流水线步骤