Add custom YAQL utility to support inline if else statement
Registered by
Winson Chan
Currently if I want to publish a variable based on an inline if-else statement (i.e. 123 if True else 456), it's unnecessary hard.
Example:
wf1:
tasks:
task1:
publish:
is_windows: (True if $.task1.guest_os == "Windows" else False)
Blueprint information
- Status:
- Not started
- Approver:
- None
- Priority:
- Undefined
- Drafter:
- Winson Chan
- Direction:
- Needs approval
- Assignee:
- None
- Definition:
- New
- Series goal:
- None
- Implementation:
- Unknown
- Milestone target:
- None
- Started by
- Completed by
Related branches
Related bugs
Sprints
Whiteboard
It is actually fairly simple to do this in YAQL, the syntax is just a bit weird.
yaql> 1 and "TRUE" or "FALSE"
"TRUE"
yaql> 0 and "TRUE" or "FALSE"
"FALSE"
yaql> "W" in "Windows" and True or False
"True"
yaql> "W" in "indows" and True or False
"False"
(?)