简体   繁体   English

发送电子邮件后 Jenkins 运行 Shell 脚本

[英]Jenkins Run Shell Script after Email Sent

When job build finishes, the Jenkins will trigger the email with the attachment on the Linux server.作业构建完成后,Jenkins 将在 Linux 服务器上触发带有附件的电子邮件。 But after the email is sent, I want to delete the attachment by running shell script again.但是发送邮件后,我想再次运行shell脚本来删除附件。 I use Editable Email plug in to send email.我使用Editable Email插件发送电子邮件。

Is there a way to do that?有没有办法做到这一点?

Note: shell script should not run immediately after the job finished, but after job finished as well as email sent.注意:shell 脚本不应在作业完成后立即运行,而是在作业完成以及电子邮件发送后运行。

Please use Post-Build task plug-in: https://wiki.jenkins.io/display/JENKINS/Post+build+task请使用Post-Build任务插件: https ://wiki.jenkins.io/display/JENKINS/Post+build+task

The pipeline is a better way of doing this, however, if you are comfortable with Free-Style job, then it's better you drag and re-arrange the post-build task to do a specific task.管道是执行此操作的更好方法,但是,如果您对 Free-Style 工作感到满意,那么您最好拖动并重新安排构建后任务以执行特定任务。

You can also do the certain task if your job is success/failure by checking the logs against specific keyword etc. Please follow plugin page for more info.如果您的工作成功/失败,您还可以通过针对特定关键字等检查日志来执行特定任务。请关注插件页面以获取更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM