[Day 22] Mattermost - with Drone Plugin

Drone CI/CD + Mattermost 组合技

虽然 drone plugins里面没有mattermost的plugin,但mattermost非常非常与slack可以相容,所以我们就找drone plugin for slack的来使用即可。

Drone Plugins Slack 说明页

先将webhooks存到drone repo内的secret

https://ithelp.ithome.com.tw/upload/images/20210915/20115289sFvs1AHkB7.png

drone yml 设定档案范例

简单玩一下的版本

drone yaml 设定

kind: pipeline
name: ithome

steps:
- name: send mattermost notification
  when:
    branch: master
  image: plugins/slack
  settings:
    webhook:
      from_secret: my-webhook
    channel: gitea

mattermost channel内显示
https://ithelp.ithome.com.tw/upload/images/20210928/20115289RVXlYDz6HT.png

设定username

drone yaml 设定

kind: pipeline
name: ithome

steps:
- name: send mattermost notification
  when:
    branch: master
  image: plugins/slack
  settings:
    webhook:
      from_secret: my-webhook
    channel: gitea
    username: ithome-use

mattermost channel内显示
https://ithelp.ithome.com.tw/upload/images/20210928/201152890QFVtPhrsF.png

设定图示

drone yaml 设定

kind: pipeline
name: ithome

steps:
- name: send mattermost notification
  when:
    branch: master
  image: plugins/slack
  settings:
    webhook:
      from_secret: my-webhook
    channel: gitea
    username: ithome-use
    image_url: https://unsplash.it/256/256/?random

mattermost channel内显示
https://ithelp.ithome.com.tw/upload/images/20210928/20115289k8yooPmqNk.png

使用自订模板

drone yaml 设定

kind: pipeline
name: ithome

steps:
- name: send mattermost notification
  when:
    branch: master
  image: plugins/slack
  settings:
    webhook:
      from_secret: my-webhook
    channel: gitea
    username: drone
    template: >
       【温馨提醒】分支: {{build.branch}},异动者: {{build.author}} 更版动作开始 {{build.link}} !!

mattermost channel内显示
https://ithelp.ithome.com.tw/upload/images/20210928/20115289T3H7RZK7IN.png

小结

今日练习是不是很简单呢?这方法可以用在当你在CI/CD有任何问题或执行成功时,可以透过这个plugin将讯息推送到你的mattermost channel很方便吧~


<<:  Day22- 场地也能选? Field Selectors

>>:  网页图片-30天学会HTML+CSS,制作精美网站

[Day3] 使用ta-lib制作指标

延续前一天的程序码,在程序码後面加上以下三行程序码,他就会用前一天做出来的日收盘价计算出均线(预设算...

递回函式与回溯法优化

题组回顾与观念统整 前三天的练习我们深入「递回(Recursion)」的方法做了一连串的实作练习,...

DAY10 - DFS

今天写广度优先搜寻(DFS),与BFS相同,DFS是一种图形搜寻演算法,在解题的时候会用来爆搜的其中...

Day17 Preparation of Gin and Env

Preface 由於之後我们会解说到像是Gin搭配RDBMS或是Gin搭配Cache....等,因此...

[Day30] 让自己过得爽,才是好主管

曾有一位与我合作的一线主管问过我一个问题:「我一直在学习观察,试着找出团队系统有没有问题,但我总觉得...