Skip to content

Finally

A finally statement is similar to a catch statement but will always execute after the try and eventual catch statements finished executing regardless of the success or failure of the test step.

Tip

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

Operations

A finally statement supports only the following operations:

Collectors

A finally statement supports all collectors:

Example

Example

apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
  name: finally
spec:
  steps:
  - try: []
    catch: []
    finally:
      - description: "Description of the finally operation"
        command:
          entrypoint: "/bin/bash"
          args: ["-c", "echo 'finally block'"]
        events: {}
        sleep:
          duration: 1s
        podLogs: {}