jenkins(二十二):Jenkins配置钉钉通知

Jenkins配置钉钉通知

https://github.com/jenkinsci/dingding-notifications-plugin

https://blog.csdn.net/weixin_34358092/article/details/85089707

 

建群-配置机器人-取得讨论组token

 

 

 

我的token,就别用我的了吧!

https://oapi.dingtalk.com/robot/send?access_token=17549607d838b3015d183384ffe53333b13df0a98563150df241535808e10781

 

安装插件

 

 

构建后-配置插件

 

 

 

 

 

pipeline方式

只支持Declarative Pipeline post方式,不支持Scripted Pipeline。默认不会显示绿色✔️或者红色✘,可以通过图片地址修改

修改imageUrl图片地址调用一个图片地址就行了

post { 
        success {
            //当此Pipeline成功时打印消息
            echo 'success'
            dingTalk accessToken:'你的token', imageUrl:'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1562563757635&di=653a6726a930e0d5d098558465162f24&imgtype=0&src=http%3A%2F%2Fhbimg.b0.upaiyun.com%2F3bfa3ce213826e955a7127bba78cacfa7326cc492dd9-KpjUkl_fw658', jenkinsUrl:'http://Jenkins地址', message:'构建成功', notifyPeople:'Jenkins-PipeLine'
        }
        failure {
            //当此Pipeline失败时打印消息
            echo 'failure'
            dingTalk accessToken:'你的token', imageUrl:'', jenkinsUrl:'http://Jenkins地址', message:'构建失败', notifyPeople:'Jenkins-PipeLine'
        }
        unstable {
            //当此Pipeline 为不稳定时打印消息
            echo 'unstable'     
        }
        aborted {
            //当此Pipeline 终止时打印消息
            echo 'aborted'  
        }
        changed {
            //当pipeline的状态与上一次build状态不同时打印消息
            echo 'changed'          
        }        
    
    }

 

posted on 2019-07-08 10:56  光阴8023  阅读(13290)  评论(0编辑  收藏  举报