jenkins集成企业微信,可发通知消息

1. 在jenkins安装插件【Qy Wechat Notification】

![在这里插入图片描述](https://img-blog.csdnimg.cn/14fc4727188344df9174418c24f8e27d.pn

2. 在企业微信的群里创建机器人

在这里插入图片描述
在这里插入图片描述

3. 在jenkins配置企业微信

这里的默认Webhook地址就是步骤2企业微信机器人的Webhook地址
在这里插入图片描述

4. 在jenkinsfile文件里加上推送语句

在这里插入图片描述

pipeline {
    
    
    agent any
    stages{
    
    
        stage('拉取代码'){
    
    
            steps {
    
    
                 ……                
                }
        }
        stage('编译构建'){
    
    
        }
        stage('远程部署'){
    
    
        }
    }
    post{
    
    
        success{
    
    
            qyWechatNotification mentionedId: '', mentionedMobile: '', moreInfo: '', webhookUrl: 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=*****************'
        }
        failure{
    
    
            qyWechatNotification mentionedId: '', mentionedMobile: '', moreInfo: '', webhookUrl: 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=*****************'
        }
    }

}

5. 发送成功

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_43466526/article/details/129304331