11

The templates and examples provided by the email-ext plugin on jenkins reference variables such as build, root, it, etc.... Where are these variables coming from and where is the documentation on them? I understand to some extent that it is the reference to the plugin instance, but that's about where my understanding ends.

If you need reference to the scripts you can see some examples here: https://github.com/jenkinsci/email-ext-plugin/tree/master/src/main/resources/hudson/plugins/emailext/templates

Josh Unger
  • 6,717
  • 6
  • 33
  • 55
AgentRegEdit
  • 1,089
  • 2
  • 16
  • 32

1 Answers1

14

build: hudson.model.AbstractBuild - your build instance.

project == build.getParent() - the job instance for your build.

it: ScriptContentBuildWrapper(build) (internal ExtEmail class)

rootUrl Jenkins URL as set in your Jenkins configuration

template: template name

Here is EmailExt plugin code link. What you are looking for is in the method ScriptContent.createEngine().

For reference, here is Jenkins API link.

stonedauwg
  • 1,328
  • 1
  • 14
  • 35
malenkiy_scot
  • 16,415
  • 6
  • 64
  • 87
  • When using a build step "Execute system Groovy script" the variable `rootURL` does not exist. I'm using this helper function: `def getRootUrl(useAbsoluteUrl=false)` `{` ` def instance = Jenkins.getInstance()` ` return useAbsoluteUrl ? instance.getRootUrl()` ` : (instance.servletContext.getContextPath()+"/")` `}` – Axel Heider Apr 03 '16 at 23:48
  • And the class where the is 'build', 'it', 'project' etc names are actually set to refer to their real objects is here - the JellyScriptContent class: https://github.com/jenkinsci/email-ext-plugin/blob/7a78d44765ad5ba4d3bbd4be1eb6ec03bb0926b0/src/main/java/hudson/plugins/emailext/plugins/content/JellyScriptContent.java – stonedauwg Feb 08 '17 at 23:15