Expressions
An expression can be any combination of contexts, operators, functions, or literals. You can use an expression as the execution condition to control job execution. Contexts can be accessed programmatically with expressions, so information such as pipeline runs, sources, variables, and jobs can be transferred within a pipeline.
Operator
Operator |
Description |
---|---|
. |
Attribute reference |
! |
False |
== |
Equal |
!= |
Not equal |
&& |
And |
|| |
Or |
Example
If the current job is executed regardless of whether the previous job (ID: job_1) succeeded or failed, the expression can be as follows:
${{ jobs.job_1.status == 'COMPLETED' || jobs.job_1.status == 'FAILED' }}
Functions
The following functions can be used in expressions:
- contains
- startsWith
- endsWith
- Object filter
You can use the * syntax to apply a filter and select matching items in a collection.
Example
The following is the context of jobs execution.
The filter jobs.*.status returns ['COMPLETED', 'FAILED'].
Filters can be used together with the contains function. For the following case, contains(jobs.*.status, 'FAILED') will return true.
{ "check_job": { "status": "COMPLETED", "metrics": { "critical": "0", "major": "0" } }, "demo_job": { "status": "FAILED" } }
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot