New 'fail-on' policy

Registered by Oleg Ovcharuk

'Fail-on' defines an expression that will move task to ERROR state if it
evaluates to ‘true’. This policy only works if task finished with SUCCESS state.
Let's consider a few examples:
The following task and execution will fail.

version: '2.0'
name: wb
workflows:
  wf1:
    tasks:
      task1:
        action: std.echo output=4
        fail-on: <% task().result <= 4 %>

The mocked action returns 1, 2, 3 and 4 one after the other.
The first execution of task fail because of the 'fail-on' policy.
The retry policy retries task. And then the task executes again and finishes with the
SUCCESS state.

version: '2.0'
name: wb
workflows:
  wf1:
    tasks:
      task1:
        action: std.echo output="mocked"
        fail-on: <% task().result <= 2 %>
        retry:
          count: 3
          delay: 0

The last example shows the interaction of 'fail-on' policy and with-items.
The mocked action returns 1, 2, 3 and 4 one after the other too.
The first execution of task fail because of the 'fail-on' policy.
The retry policy retries task. And then the task executes again and finishes with the
SUCCESS state.

version: '2.0'
name: wb
workflows:
  wf1:
    tasks:
      task1:
        with-items: x in [1, 2]
        action: std.echo output="mocked"
        fail-on: <% not task().result.contains(4) %>
        retry:
          count: 3
          delay: 0

Blueprint information

Status:
Not started
Approver:
Renat Akhmerov
Priority:
Undefined
Drafter:
Oleg Ovcharuk
Direction:
Needs approval
Assignee:
None
Definition:
New
Series goal:
Accepted for train
Implementation:
Unknown
Milestone target:
None

Related branches

Sprints

Whiteboard

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.