This is a Feishu (Lark) notification plugin for Jenkins that supports sending notification messages to Feishu group chats after build completion.
- ✅ Support for traditional Jenkins Jobs and Pipeline mode
- ✅ Support for global configuration with project inheritance or override
- ✅ Support for Feishu bot webhook notifications
- ✅ Support for signature verification security mechanism
- ✅ Customizable notification timing (success/failure/unstable/aborted)
- ✅ Support for custom message content and colors
- ✅ Built-in connection testing functionality
- ✅ Multi-language support (English/Chinese)
git clone <repository-url>
cd feishu-notify-plugin
mvn clean packageThen upload the generated target/feishu-notify.hpi file in Jenkins management page.
- Go to Jenkins -> Manage Jenkins -> Manage Plugins
- Search for "Feishu Notify" in "Available" plugins
- Install and restart Jenkins
- Go to Jenkins -> Manage Jenkins -> Configure System
- Find "Feishu Notification Global Configuration" section
- Configure global Webhook URL and secret (optional)
- Check "Enable Global Configuration"
- In Feishu group chat, click settings button in upper right corner
- Select "Bot" -> "Add Bot" -> "Custom Bot"
- Set bot name and description
- Copy the generated Webhook address (format:
https://open.feishu.cn/open-apis/bot/v2/hook/...) - Set signature secret if security verification is needed
- In Job configuration page, find "Post-build Actions" section
- Add "Feishu Notification" action
- Configure Webhook URL (optional, uses global configuration if not set)
- Select notification timing
- Add custom message (optional)
Use feishuNotify step in Jenkinsfile:
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Building...'
// Your build steps
}
}
}
post {
success {
feishuNotify(
message: 'Build completed successfully!',
title: 'Jenkins Build Notification',
color: 'green'
)
}
failure {
feishuNotify(
message: 'Build failed, please check logs',
title: 'Jenkins Build Notification',
color: 'red'
)
}
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
webhookUrl |
String | No | Feishu Webhook URL, uses global configuration if not set |
secret |
String | No | Signature secret, uses global configuration if not set |
message |
String | Yes | Message content |
title |
String | No | Message title, defaults to "Jenkins Pipeline Notification" |
color |
String | No | Message color: blue, green, yellow, red |
atAll |
Boolean | No | Whether to @all members, defaults to false |
- Direct configuration in Pipeline step (highest priority)
- Job-level configuration
- Global configuration (lowest priority)
If a configuration item is not set at a higher priority level, the next level configuration will be used automatically.
这是一个用于Jenkins的飞书(Lark)通知插件,支持在构建完成后向飞书群聊发送通知消息。
- ✅ 支持传统Jenkins Job和Pipeline模式
- ✅ 支持全局配置,项目可继承或覆盖
- ✅ 支持飞书机器人Webhook通知
- ✅ 支持签名验证安全机制
- ✅ 可自定义通知时机(成功/失败/不稳定/中止)
- ✅ 支持自定义消息内容和颜色
- ✅ 提供连接测试功能
- ✅ 多语言支持(中文/英文)
git clone <repository-url>
cd feishu-notify-plugin
mvn clean package然后在Jenkins管理页面上传生成的target/feishu-notify.hpi文件。
- 进入Jenkins -> 系统管理 -> 插件管理
- 在"可选插件"中搜索"Feishu Notify"
- 安装并重启Jenkins
- 进入Jenkins -> 系统管理 -> 系统配置
- 找到"飞书通知全局配置"部分
- 配置全局Webhook URL和签名密钥(可选)
- 勾选"启用全局配置"
- 在飞书群聊中,点击右上角设置按钮
- 选择"机器人" -> "添加机器人" -> "自定义机器人"
- 设置机器人名称和描述
- 复制生成的Webhook地址(格式:
https://open.feishu.cn/open-apis/bot/v2/hook/...) - 如需安全验证,可设置签名密钥
- 在Job配置页面,找到"构建后操作"部分
- 添加"飞书通知"操作
- 配置Webhook URL(可选,未配置时使用全局配置)
- 选择通知时机
- 添加自定义消息(可选)
在Jenkinsfile中使用feishuNotify步骤:
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Building...'
// 你的构建步骤
}
}
}
post {
success {
feishuNotify(
message: '构建成功完成!',
title: 'Jenkins构建通知',
color: 'green'
)
}
failure {
feishuNotify(
message: '构建失败,请检查日志',
title: 'Jenkins构建通知',
color: 'red'
)
}
}
}| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
webhookUrl |
String | 否 | 飞书Webhook URL,未设置时使用全局配置 |
secret |
String | 否 | 签名密钥,未设置时使用全局配置 |
message |
String | 是 | 消息内容 |
title |
String | 否 | 消息标题,默认为"Jenkins Pipeline通知" |
color |
String | 否 | 消息颜色:blue(蓝色)、green(绿色)、yellow(黄色)、red(红色) |
atAll |
Boolean | 否 | 是否@所有人,默认false |
- Pipeline步骤中的直接配置 (最高优先级)
- Job级别的配置
- 全局配置 (最低优先级)
如果某个配置项在高优先级中未设置,会自动使用下一级的配置。
- Java 8+
- Maven 3.6+
- Jenkins 2.361.4+
# 编译
mvn compile
# 运行测试
mvn test
# 打包
mvn package
# 启动测试Jenkins实例
mvn hpi:runMIT License
欢迎提交Issue和Pull Request!
- 初始版本发布
- 支持基本的飞书通知功能
- 支持全局配置
- 支持Pipeline模式
- 多语言支持(中文/英文)