Skip to content

Handling failures is extremely inconvenient for complex jobs #47

@Nopik

Description

@Nopik

Lets assume that there is a job which runs one task:

- task: task1
  file: foo/task1.yml

and we have some resource sending out notifications about success or failure (e.g. via email or slack). It goes like this (assuming that resources are configured):

- task: task1
  file: foo/task1.yml
- aggregate:
  - conditions: [success]
    put: email
    params:
      text: Success!
  - conditions: [failure]
    put: email
    params:
       text: Failure!

That already is increase from 2 lines to 11. Now, lets suppose that we have 2 tasks running inside job:

- task: task1
  file: foo/task1.yml
- aggregate:
  - conditions: [success]
    name: task1-succeeded
    do:
    - task: task2
      file: foo/task2.yml
    - aggregate:
      - conditions: [success]
        put: email
        params:
          text: Success!
      - conditions: [failure]
        put: email
        params:
           text: Failure!
  - conditions: [failure]
    put: email
    params:
       text: Failure!

Which is 21 lines. Adding 3rd and 4th tasks would be overkill.

I'm looking for try / catch / finally kind of approach, where one could add just one error handler at the end or something like this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions