The condition syntax supports the following functions.
add(Number, Number) Number
Usage:
add(1, 2) == 3
add(5, ${foo}) >= 5
arrayContains(Array, String) Boolean
Usage:
arrayContains(${docker.labels}, 'monitor')
concat(String, String) String
Note
|
Parameters are coerced into strings before the concatenation. |
Usage:
concat("foo", "bar") == "foobar"
concat(${var1}, ${var2}) != "foobar"
divide(Number, Number) Number
Usage:
divide(25, 5) > 0
divide(${var1}, ${var2}) > 7
endsWith(String, String) Boolean
Usage:
endsWith("hello world", "hello") == true
endsWith(${var1}, "hello") != true
hasKey(Dictionary, String) Boolean
Usage:
hasKey(${host}, "platform")
indexOf(String, String, Number?) Number
Note
|
Returns -1 if the string is not found. |
Usage:
indexOf("hello", "llo") == 2
indexOf(${var1}, "hello") >= 0
length(Array|Dictionary|string)
Usage:
length("foobar") > 2
length(${docker.labels}) > 0
length(${host}) > 2
match(String, Regexp) boolean
Note
|
Regexp supports Go’s regular expression syntax. Conditions that use
regular expressions are more expensive to run. If speed is critical, consider
using endWiths or startsWith .
|
Usage:
match("hello world", "^hello") == true
match(${var1}, "world$") == true
modulo(number, number) Number
Usage:
modulo(25, 5) > 0
modulo(${var1}, ${var2}) == 0
multiply(Number, Number) Number
Usage:
multiply(5, 5) == 25
multiple(${var1}, ${var2}) > x
number(String) Integer
Usage:
number("42") == 42
number(${var1}) == 42
startsWith(String, String) Boolean
Usage:
startsWith("hello world", "hello") == true
startsWith(${var1}, "hello") != true
string(Number) String
Usage:
string(42) == "42"
string(${var1}) == "42"
stringContains(String, String) Boolean
Usage:
stringContains("hello world", "hello") == true
stringContains(${var1}, "hello") != true
subtract(Number, Number) Number
Usage:
subtract(5, 1) == 4
subtract(${foo}, 2) != 2