Skip to content

Catch

A catch statement is also a sequence of operations or collectors.

Operations and collectors contained in a catch statement will be executed only if the step failed when executing the operations in the step's try statement.

Tip

All operations and collectors of a catch statement will be executed regardless of the success or failure of each of them.

Operations

A catch statement supports only the following operations:

Collectors

A catch statement supports all collectors:

Example

Example

apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
  name: example
spec:
  steps:
  - try: []
    catch:
    - command:
        # ...
    - script:
        # ...
    - delete:
        # ...
    - events:
        # ...
    - podLogs:
        # ...
    - describe:
        # ...
    - get:
        # ...
    - sleep:
        # ...
    - wait:
        # ...
    finally: []