「Jenkins Plugins」- Email Extension

  CREATED BY JENKINSBOT

在 Freestyle project 中,发送邮件给 Git 提交者

Passing variable from shell to email-ext in Jenkins – Stack Overflow

技术关键词:Content Token Reference, Token Macro

第一步、在 Build 中,执行如下脚本,创建 env.properties 配置:

rm -f ${WORKSPACE}/env.properties
touch ${WORKSPACE}/env.properties

GIT_COMMITER_EMAIL=$(git --no-pager show -s --format='%ae')
echo "git.committer=${GIT_COMMITER_EMAIL}" >> ${WORKSPACE}/env.properties

cat ${WORKSPACE}/env.properties

第二步、在 Editable Email Notification 中,设置 Project Recipient List 为:

${PROPFILE,file="env.properties",property="git.committer"}

参考文献

Token Macro | Jenkins plugin
Email Extension | Jenkins plugin