condition_from_variable_match
Test the content of a string variable.
⚙️ Compatible targets: Linux, Windows
Parameters
Name | Documentation |
---|---|
condition | Prefix of the class (condition) generated. This parameter is required. |
variable_name | Complete name of the variable being tested, like my_prefix.my_variable. This parameter is required. |
expected_match | Regex to use to test if the variable content is compliant. This parameter is required. |
Outcome conditions
You need to replace ${condition}
with its actual canonified value.
- ✅ Ok:
condition_from_variable_match_${condition}_ok
- ☑️ Already compliant:
condition_from_variable_match_${condition}_kept
- 🟨 Repaired:
condition_from_variable_match_${condition}_repaired
- ☑️ Already compliant:
- ❌ Error:
condition_from_variable_match_${condition}_error
Example
method: condition_from_variable_match
params:
expected_match: VALUE
condition: VALUE
variable_name: VALUE
Documentation
Test a string variable content and create conditions depending on its value:
- If the variable is found and its content matches the given regex:
- a
${condition}_true
condition, - and kept outcome status
- a
- If the variable is found but its content does not match the given regex:
- a
${condition}_false
condition, - and a kept outcome status
- a
- If the variable can not be found:
- a
${condition}_false
condition - and an error outcome status
- a
Be careful, we are using variable name not the value. For example if you want to match the property value "foo"
you will just need node.properties[foo]
without ${...}
syntax
/!\ Regex for unix machine must be PCRE compatible and those for Windows agent must respect the .Net regex format.
- If you want to test a technique parameter, use the
technique_id
of the technique as variable prefix and theparameter_name
as variable name.
The method only supports plain string type variables.