cookbook:
  name: Tutorial 06 Callbacks And Cleanup
  canonical_name: tutorial-06-callbacks-and-cleanup
  environment:
    public: []
    secrets: []
  pages:
    - page: 1
      name: Environments
      callbacks:
        on_action:
          steps:
            - step: 1
              name: Record accepted action
              image: tutorial-callbacks:dev
              timeout: 1.minute
      recipes:
        - recipe: Environment A
          canonical_name: environment-a
          description: Activate state and remove it when another recipe replaces it.
          form: []
          callbacks:
            on_deactivate:
              steps:
                - step: 1
                  name: Remove Environment A
                  image: tutorial-callbacks:dev
                  timeout: 1.minute
          now:
            steps:
              - step: 10
                name: Activate Environment A
                image: tutorial-callbacks:dev
                timeout: 1.minute
        - recipe: Environment B
          canonical_name: environment-b
          description: Prepare, apply, and verify replacement state.
          form: []
          callbacks:
            before_run:
              steps:
                - step: 1
                  name: Prepare Environment B
                  image: tutorial-callbacks:dev
                  timeout: 1.minute
            after_run:
              steps:
                - step: 1
                  name: Verify Environment B
                  image: tutorial-callbacks:dev
                  timeout: 1.minute
          now:
            steps:
              - step: 10
                name: Apply Environment B
                image: tutorial-callbacks:dev
                timeout: 1.minute
        - recipe: Retryable Cleanup
          canonical_name: retryable-cleanup
          description: Fail cleanup once, then succeed through the cleanup retry path.
          form: []
          callbacks:
            on_deactivate:
              steps:
                - step: 1
                  name: Retryable cleanup
                  image: tutorial-callbacks:dev
                  timeout: 1.minute
          now:
            steps:
              - step: 10
                name: Activate retryable state
                image: tutorial-callbacks:dev
                timeout: 1.minute
