詹金斯电子邮件-EXT pre-发送脚本 [英] Jenkins Email-ext Pre-send Script

查看:492
本文介绍了詹金斯电子邮件-EXT pre-发送脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在电子邮件-EXT詹金斯插件pre-发送脚本编辑电子邮件正文。
我应该使用什么语言来写code?
bash脚本或其他?
你可以添加一些片code的?
谢谢你。

I want to edit email body in pre-send script in Email-ext Jenkins plugin. What language should I use to write code? Bash script or other? Can you add some piece of code? Thanks.

推荐答案

您必须使用的语言是Groovy中,你可以测试你的code的一块詹金斯下的脚本控制台>管理>脚本任何没有按' ŧ依靠构建特定的值。

The language you must use is Groovy, you can test your piece of code in the script console under Jenkins > Manage > script for anything that doesn't rely on build specific values.

例子,将取消发送电子邮件,如果有任何变化(使用Git时测试):

Example that cancels sending the email if there have been no changes (tested when using Git):

if (build.changeSet.emptySet) cancel=true;

Groovy是某种真正使用Java幕后方便的脚本语言,所以你可能不得不挖掘到詹金斯的java类,看看有什么被定义/你可以使用哪些对象。比如在我的示例code编译变量是真的,当我对我的工作詹金斯(这是一个自由的风格构建工作明显)运行的Java对象FreeStyleBuild。

Groovy is some sort of convenient scripting language that really uses Java behind the scenes, so you'll probably have to dig into the Jenkins java classes to see what is defined/what objects you can use. For instance the build variable in my sample code is really the java object FreeStyleBuild when I run it on my Jenkins job (which is a free style build job obviously).

这篇关于詹金斯电子邮件-EXT pre-发送脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆