当我的构建成功时,我得到一个松弛的通知,当它失败时,我没有。查看Drone Web UI,一旦构建失败并且slack plugin永远不会运行,它看起来就会停止。
成功构建会导致notify
发生:
构建失败无法进入通知阶段:
.drone.yml
的关键部分如下:
build:
image: propheris/ruby:2.4.0
secrets: [gems_password]
commands:
- exit 0
notify:
image: plugins/slack
webhook: https://example.com/hooks/token
channel: dev
username: drone
icon_emoji: drone
我更改exit 0
或exit 1
以模拟成功或失败的构建。
答案 0 :(得分:0)
我看了一下这些文档,似乎你错过了以下几行:
when:
status: [ success, failure ]
docs州:
成功和失败消息的配置示例:
pipeline:
slack:
image: plugins/slack
webhook: https://hooks.slack.com/services/...
channel: dev
when:
status: [ success, failure ]
您还可以添加自定义消息:
使用自定义消息模板的示例配置:
pipeline:
slack:
image: plugins/slack
webhook: https://hooks.slack.com/services/...
channel: dev
template: >
{{#success build.status}}
build {{build.number}} succeeded. Good job.
{{else}}
build {{build.number}} failed. Fix me please.
{{/success}}