2012-04-02 39 views
11

jenkins引用变量上的email-ext插件提供的模板和示例,例如build, root, it等....这些变量来自哪里以及文档在哪里?我在一定程度上理解it是插件实例的参考,但这是关于我的理解结束的地方。来自email-ext jelly/groovy脚本的实例变量在哪里?

如果您需要参考脚本,你可以在这里看到一些例子: https://github.com/jenkinsci/email-ext-plugin/tree/master/src/main/resources/hudson/plugins/emailext/templates

回答

13

buildhudson.model.AbstractBuild - 您的构建实例。

project == build.getParent() - 构建的作业实例。

itScriptContentBuildWrapper(build)(内部ExtEmail类)

rootUrl詹金斯快照您詹金斯配置

template设置:模板名称

这里是EmailExt plugin code link。你正在寻找的是方法ScriptContent.createEngine()

仅供参考,这里是Jenkins API link

+0

当使用构建步骤“执行系统Groovy脚本”时,变量'rootURL'不存在。我使用这个辅助函数: '高清getRootUrl(useAbsoluteUrl = FALSE)'' {'' 高清例如= Jenkins.getInstance()'' 返回useAbsoluteUrl? instance.getRootUrl()' ':(instance.servletContext.getContextPath()+“/”)' '}' – 2016-04-03 23:48:41

+0

其中'build','it','project'等名字的类实际上是设置的引用他们的真实对象在这里 - JellyScriptContent类:https://github.com/jenkinsci/email-ext-plugin/blob/7a78d44765ad5ba4d3bbd4be1eb6ec03bb0926b0/src/main/java/hudson/plugins/emailext/plugins/content/JellyScriptContent的.java – stonedauwg 2017-02-08 23:15:34

相关问题