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'          
        }        
    
    }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM