Created to make it a little easier to find the macro that you need outside of opening a Freestyle job in Jenkins.
Arguments may be given for each token in the form name="value" for strings and in the form name=value for booleans and numbers. In string arguments, escape ", , and line terminators (\n or \r\n) with a , e.g. arg1=""quoted""; arg2="c:\path"; and arg3="one\ntwo". The brackets may be omitted if there are no arguments.
Examples:
This is the default email subject that is configured in Jenkinss system configuration page.
This is the default email content that is configured in Jenkinss system configuration page.
This is the default pre-send script content that is configured in Jenkinss system configuration. This is the only token supported in the pre-send script entry field.
This is the default post-send script content that is configured in Jenkinss system configuration. This is the only token supported in the post-send script entry field.
This is the default email subject for this project. The result of using this token in the advanced configuration is what is in the Default Subject field above. WARNING: Do not use this token in the Default Subject or Content fields. Doing this has an undefined result.
This is the default email content for this project. The result of using this token in the advanced configuration is what is in the Default Content field above. WARNING: Do not use this token in the Default Subject or Content fields. Doing this has an undefined result.
Extended Email Publisher Specific Tokens
Custom message content generated from a Jelly script template. There are two templates provided: "html" and "text". Custom Jelly templates should be placed in
Custom message content generated from a groovy script.Custom scripts should be placed in "$JENKINS_HOME/email-templates". When using a custom script the plugin will look in the resources forthe email-ext plugin first, and then in the
script
- When this is used, only the last value in the script will be used in the expansion (script and template can not be used together).template
- The template in Groovy's SimpleTemplateEngine format.
Custom message content generated from a template file.Custom templates should be placed in "$JENKINS_HOME/email-templates". When using a custom script the plugin will look in the resources forthe email-ext plugin first, and then in the
file
- The template in plain text format.
Token Macro Plugin Tokens
Expands to the build result of the CCM plug-in.
Expands to the total number of CCM warnings in a build.
Expands to the total number of fixed CCM warnings in a build.
Expands to the total number of new CCM warnings in a build.
Displays failing unit test information, if any tests failed.
showStack
Shows stack trace in failing test output. Defaults to true.showMessage
Shows error message in failing test output. Defaults to true.maxTests
Display at most this many tests. No limit is set by default.onlyRegressions
Display only the failing tests that are different from previous builds. Defaults to false.
Displays the number of tests based on the type (var) passed in (total, pass, fail, skip). Defaults to total.
Expands to the name of the branch that was built. Parameters
all
If specified, all the branches that point to the given commit is listed. By default, the token expands to just one of them.fullName
If specified, this token expands to the full branch name, such as 'origin/master'. Otherwise, it only expands to the short name, such as 'master'.
Expands to the Git SHA1 commit ID that points to the commit that was built. Parameters
length=N
(optional, default to 40) Specify the commit ID length. Full SHA1 commit ID is 40 character long, but it is common to cut it off at 8 or 12 as that often provide enough uniqueness and is a lot more legible.
Executes Groovy code Example:
${GROOVY,script = "return jenkins.model.Jenkins.instance.pluginManager.plugins"}
Note: By default, the support for token macro pressing is switched off and has to be switch on in global config page. Warning: If token macro processing via Token Macro Plugin is allowed, the evaluation of macro is done in System Groovy, therefore any user can run arbitrary system script, regardless he has administer permission!
Expands to the total number of fixed compiler warnings in a build.
Expands to the total number of new compiler warnings in a build.
Expands to the total number of compiler warnings in a build.
Expands to the build result of the warnings plug-in.
Expands to the build result of the Dependency-Check plug-in.
Expands to the total number of Dependency-Check warnings in a build.
Expands to the total number of fixed Dependency-Check warnings in a build.
Expands to the total number of new Dependency-Check warnings in a build.
Displays the email address for the Jenkins administrator
Displays the cause of the build.
Displays an excerpt from the build log.
start
- Regular expression to match the excerpt starting line (matching line is excluded).end
- Regular expression to match the excerpt ending line (matching line is excluded). Seejava.util.regex.Pattern
Displays the end of the build log.
maxLines
- Display at most this many lines of the log. Defaults to 250.escapeHtml
- If true, HTML is escape. Defaults to false.
Displays build log segments that match the regular expression.
regex
-java.util.regex.Pattern
Segments of the build log that match this regular expression are included. See also null. No default. Required parametermaxMatches
- The maximum number of matches to include. If 0, all matches will be included. Defaults to 0.showTruncatedLines
- If true, include [...truncated ### lines...] lines. Defaults to true.substText
- If non-null, insert this text into the email rather than the entire segment. Defaults to null.escapeHtml
- If true, escape HTML. Defaults to false.matchedSegmentHtmlStyle
- If non-null, output HTML. Matched lines will become<b style="your-style-value">html escaped matched lines</b>
. Defaults to null.
Displays lines from the build log that match the regular expression.
regex
- Lines that match this regular expression are included. See also java.util.regex.Pattern.Defaults to "(?i)\b(error|exception|fatal|fail(ed|ure)|un(defined|resolved))\b"linesBefore
- The number of lines to include before the matching line. Lines that overlap with another match or linesAfter are only inlcuded once. Defaults to 0.linesAfter
- The number of lines to include after the matching line. Lines that overlap with another match or linesBefore are only included once. Defaults to 0.maxMatches
- The maximum number of matches to include. If 0, all matches will be included. Defaults to 0.showTruncatedLines
- If true, include [...truncated ### lines...] lines. Defaults to true.substText
- If non-null, insert this text into the email rather than the entire line. Defaults to null.escapeHtml
- If true, escape HTML. Defauts to false.matchedLineHtmlStyle
- If non-null, output HTML. Matched lines will become<b style="your-style-value"> html escaped matched line</b>
. Defaults to null.addNewline
- If true, adds a newline after subsText. Defaults to true.defaultValue
- This value will be used if nothing is replaced.
Expands to the current build number, a sequential auto-incrementing unique number that identifies the build, such as "125"
##${BUILD_STATUS}
Displays the status of the current build. (failing, success, etc...)
Displays the URL for the current build
Displays the changes since the last build.
showDependencies
If true, changes to projects this build depends on are shown. Defaults to falseshowPaths
If true, the paths, modified by a commit are shown. Defaults to falseformat
For each commit listed, a string containing %X, where %x is one of:%a
= author%d
= date%m
= message%p
= path%r
= revision
Not all revision systems support %d
and %r
. If specified showPaths argument is ignored. Defaults to "[%a] %m\n"
pathFormat
- A string containing %p to indicate how to print paths. Defaults to "\t%p\n"regex
- A regular expression.replace
- A replacement for all sub-strings of the change message that match the given regular expression.default
- Message to use when no changes are detected. Defaults to "No changes\n"
Displays the changes since the last successful build.
-
reverse
- If true, show most recent builds at the top instead of the bottom. Defaults to false. -
format
- For each build listed, a string containing %X, where %X is one of- %c = changes
- %n = build number Defaults to Changes for Build #%n\n%c\n
-
changesFormat
- For each change in a build. See${CHANGES_SINCE_LAST_BUILD}
for placeholders. Following Parameters are also supported:showPaths
,pathForma
t,showDependencies
,dateFormat
,regex
,replace
,default
. See${CHANGES_SINCE_LAST_BUILD}
details.
Expands to the changes since the last unstable or successful build.
-
reverse
- If true, show most recent builds at the top instead of the bottom. Defaults to false. -
format
- For each build listed, a string containing %X, where %X is one of- %c = changes
- %n = build number Defaults to Changes for Build #%n\n%c\n
-
changesFormat
- For each change in a build. See${CHANGES_SINCE_LAST_BUILD}
for placeholders. Following Parameters are also supported: showPaths, pathFormat, showDependencies, dateFormat, regex, replace, default. See${CHANGES_SINCE_LAST_BUILD}
details.
Expands to an environment variable (specified here as VARIABLENAME) from the build environment. Note that this does not include any variables set by the build scripts themselves, only those set by Jenkins and other plugins.
Displays the URL to the Jenkins server. (You can change this on the system configuration page.)
Displays the description of the job.
Uses a regular expression to find a single log entry and generates a new output using the capture groups from it. This is partially based on the description-setter plugin (https://github.com/jenkinsci/description-setter-plugin).
Displays the project's full name. (See AbstractProject.getFullDisplayName)
Displays the project's display name. (See AbstractProject.getDisplayName)
Displays a URL to the project's page.
Expands to the value of a property in a property file. The filename is relative to the build workspace root.
Expands to the contents of a file. The file path is relative to the build workspace root.
Expands to the result(s) of an XPath expression run against the given XML file. If the XPath evaluates to more than one value, then a semicolon-separated string is returned. The file path is relative to the build workspace root.
In addition to the tokens, you can modify the result of the token expansion using parameter expansions. They follow similar rules as bash Parameter Expansions. The supported expansions are: ${#TOKEN} which resolves to the length of the expanded token value, ${TOKEN:offset:length} which takes a substring of the token result (length is optional and offset and length can both be negative), ${TOKEN#pattern} which matches the pattern against the start of the expanded token and removes it if it, ${TOKEN%pattern} which matches the pattern against the end of the expanded token and removes it it if matches.
Hi there! Can you tell how to find all the available Token Macros in an existing Jenkins installation?
I would like to access the tokens exposed (if any) by the P4 plugin.