惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Vercel News
Vercel News
Recorded Future
Recorded Future
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
The GitHub Blog
The GitHub Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Google DeepMind News
Google DeepMind News
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Microsoft Azure Blog
Microsoft Azure Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
M
MIT News - Artificial intelligence
云风的 BLOG
云风的 BLOG
Y
Y Combinator Blog
N
News | PayPal Newsroom
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Help Net Security
Help Net Security
博客园 - Franky
SecWiki News
SecWiki News
Recent Announcements
Recent Announcements
T
Troy Hunt's Blog
The Register - Security
The Register - Security
The Last Watchdog
The Last Watchdog
Webroot Blog
Webroot Blog
S
Security Affairs
博客园 - 司徒正美
S
Schneier on Security
I
InfoQ
博客园_首页
www.infosecurity-magazine.com
www.infosecurity-magazine.com
T
Threat Research - Cisco Blogs
Forbes - Security
Forbes - Security
腾讯CDC
N
Netflix TechBlog - Medium
N
News and Events Feed by Topic
Cloudbric
Cloudbric
T
The Exploit Database - CXSecurity.com
P
Proofpoint News Feed
A
About on SuperTechFans
Engineering at Meta
Engineering at Meta
Recent Commits to openclaw:main
Recent Commits to openclaw:main
B
Blog
V
Vulnerabilities – Threatpost
C
Check Point Blog
Google DeepMind News
Google DeepMind News
Google Online Security Blog
Google Online Security Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
Hacker News - Newest:
Hacker News - Newest: "LLM"
C
Cisco Blogs
Schneier on Security
Schneier on Security
O
OpenAI News
K
Kaspersky official blog

mafeifan 的编程技术分享

mafengwo-mp3-downloader | mafeifan 的编程技术分享 示例页面 | mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 查看 default namespace 下的 default service account名称 mafeifan 的编程技术分享 检查日志 | mafeifan 的编程技术分享 bridge fdb show dev flannel.1 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 数据收集原理分析 | mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 几种方法 | mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 check the export on the very top of this document so we can use $do mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 延伸 -- 关于前端路由 xdebug 3 和 2 的区别
mafeifan 的编程技术分享
2026-01-16 · via mafeifan 的编程技术分享

需求:需要把 Jenkins 的构建情况通过邮件,钉钉,Slack等通知告诉相关的测试,开发人员。 结合之前讲的 post钩子 更进一步可以实现失败时只通知给开发人员,成功通知给所有人员等。

邮件通知 ​

这个需要在Jenkins中配置发件人的信息,如SMTP服务器,默认的邮件内容等 来到Jenkins的Configure System

  1. 首先在配置页面搜索 Location 配置 Jenkins 管理员的邮箱

image.png

  1. 搜索'E-mail Notification'

可能会发现有两个E-mail Notification,一个是Extended E-mail Notification另一个是E-mail Notification。前者是安装Jenkins时顺便安装的插件,后者是自带的。

自带的E-mail Notification功能较弱,我们配置 Extended E-mail Notification,配置项比较多,不懂的点问号图标。

image.png

  1. 来到Pipeline项目的配置页面, 通过点击 Pipeline Syntax 来到 Snippet Generator, 生成pipeline脚本。 Step 选择 mailtext: Extended Email。

image.png

修改pipeline,添加发送邮件的步骤,放到pipeline的post部分的always块内,你也可以改为failure

groovy

    post {
      always {
        emailext to: 'mafeifan@qq.com', subject: "Job [${env.JOB_NAME}] - Status: ${currentBuild.result?: 'success'}", body: 
"""
<p>EXECUTED: Job <b>\' ${env.JOB_NAME}:${env.BUILD_NUMBER}\'
</b></p><p>View console output at "<a href= "${env.BUILD_URL}">
${env.JOB_NAME}:${env.BUILD_NUMBER}</a>"</p>
<p><i>(Build log is attached.)</i></p>
""", attachLog: true, compressLog: true
  }

效果如下:

image.png

你也可以使用全局配置默认subject和content,使用方法如下:

groovy

post {
  always {
    emailext (
      to: 'my@my.dom', 
      replyTo: 'my@my.dom', 
      subject: '$DEFAULT_SUBJECT',
      body: '$DEFAULT_CONTENT',
      mimeType: 'text/html'
    );
  }
}

主要要用单引号包裹变量,否则groovy会尝试扩展变量

关于一些参数

  • attachLog(可选):将构建日志以附件形式发送
  • compressLog(可选):压缩日志
  • recipientProviders(可选): List 类型,收件人列表类型
  • replyTo(可选):回复邮箱
  • recipientProviders (可选):收件人列表类型
类型名称helper方法名描述
Culpritsculprits()引发构建失败的人。最后一次构建成功和最后一次构建失败之间的变更提交者列表
Developersdevelopers()此次构建所涉及的变更的所有提交者列表
Requestorrequestor()请求构建的人,一般指手动触发构建的人
Upstream CommittersupstreamDevelopers()上游job变更提交者的列表

更多参数见文档

Slack 通知 ​

Slack 号称邮件杀手,是一款国外很火的消息聚合平台服务,通过建立不同的频道降低团队沟通的干扰。

  1. Jenkins 安装 Slack Notification Plugin

  2. 打开插件Github官网 根据提示没有账号的话先申请账号

  3. Slack 端集成 Jenkin CI,首先,网页端登录slack,进到自己的workspace,然后添加Jenkins应用,需要选择一个要推送通知的频道

image.png

  1. 根据指引配置就可以了,非常人性,下图在FreeStyle类型的项目中可配

image.png

image.png

  1. 如果需要通过Pipeline代码触发

groovy

post {
  always {
    slackSend channel: "#机器人", message: "Build Started: ${env.JOB_NAME} ${env.BUILD_NUMBER}"
  }

更多参数还是参见非常好用的Pipeline Syntax 的 Snippet Generator

image.png

效果:

image.png

钉钉通知 ​

Slack 有时候国内速度访问比较慢,如果公司喜欢用钉钉,也可以集成钉钉通知。 步骤是类似的,不再赘述,见文档

问题 ​

使用邮件,想把构建日志作为邮件内容发送出去,但是使用 ${env.BUILD_LOG} 返回 null,可以改为\${BUILD_LOG} groovy 会展开所有的变量,然后留给email ext 处理这个变量 网上也有人问了类似的问题,可以使用 currentBuild.rawBuild.getLog(15) 获取最后的15行日志,不过需要在 scriptApproval 页面批准下 method org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper getRawBuild

image.png

参考 ​