Skip to content

on_success Step Hook

on_success: step

A hook step to execute if the parent step succeeds.


Running on success

The following will perform the second task only if the first one succeeds:

plan:
  - get: foo
  - task: unit
    file: foo/unit.yml
    on_success:
      task: alert
      file: foo/alert.yml

Note that this is semantically equivalent to the following:

plan:
  - get: foo
  - task: unit
    file: foo/unit.yml
  - task: alert
    file: foo/alert.yml

The on_success hook is provided mainly for cases where there is an equivalent on_failure, and having them next to each other is more clear.