Expression Values

Expression values allow you to access data within the event that triggered the rule and use them in rule actions.

Expression Language

The expression language is based on the dot notation method to access attributes of objects between double square brackets, e.g. [[build.result]] to access the result of the build in the event that triggered the rule execution.

Object Reference

rule

[[rule.id]] Prints the rule id.
[[rule.name]] Prints the rule name.
[[rule.description]] Prints the rule description.

event

[[event.x]] Where x is the name of the attribute of the event. Check below to see what other objects are available in the event.
[[event.timestamp]] Returns the java.time.LocalDateTime referencing the timestamp the event was emitted.

site

[[site.id]] Prints the ID of the site.
[[site.name]] Prints the name of the site.
[[site.displayUrl]] Prints the URL of the site that can be used by users.

job

Available when using the Job Synchronized rule event.

The [[job]] object can also be referenced via the event attribute [[event.job]].

[[job.id]] Prints the ID of the job.
[[job.site]] References the site the job is hosted on, see site. Use [[job.site.name]] to print the name of the site.
[[job.name]] Prints the name of the job.
[[job.displayName]] Prints the display name of the job.
[[job.displayUrl]] Prints the URL of the job that can be used by users.
[[job.description]] Prints the description of the job.

build

Available when using the Build Synchronized rule event.

The [[build]] object can also be referenced via the event attribute [[event.build]].

[[build.id]] Prints the ID of the build.
[[build.job]] References the job of the build, see job. Use [[build.job.name]] to print the name of the job.
[[build.number]] Prints the build number.
[[build.displayName]] Prints the display name of the build, defaults to [[build.job.displayName]] #[[build.number]]
[[build.displayUrl]] Prints the URL of the build that can be used by users.
[[build.description]] Prints the description of the build.
[[build.cause]] Prints the cause of the build.
[[build.result]] References the result type of the build.
Known results include, from best to worst: SUCCESS, UNSTABLE, FAILURE, NOT_BUILT, ABORTED, UNKNOWN.
[[build.builtOn]] Prints the name of the node where the build was executed on.
[[build.duration]] Prints the duration of the build in milliseconds.
[[build.formattedDuration]] Prints the formatted duration of the build, e.g. ‘2m 15s’
[[build.timestamp]] Prints the timestamp the build was scheduled in milliseconds since epoch, January 1, 1970, 00:00:00 GMT.
[[build.buildDate]] References the java.util.Date reference to the timestamp when the build was scheduled.
[[build.testResults.passed]] Prints the number of tests that passed.
[[build.testResults.failed]] Prints the number of tests that failed.
[[build.testResults.skipped]] Prints the number of tests that where skipped.
[[build.testResults.total]] Prints the total number of tests that where part of the build.

Function Reference

[[#now]] Returns the java.time.LocalDateTime referencing the timestamp the expression is evaluated.
[[#today]] Returns the java.time.LocalDate referencing the timestamp the expression is evaluated.