Pipeline step guaranteed to run regardless of errors

In our piepline we have several steps ran across several stages. Some of them may fail (accepted when i.e. create something k8s which already exists) and we don’t care about those errors.
But regardless of any failures or errors we need to clean up created resources after - is there any way I can specify some task/job which will always run as the last one where I can put housekeeping steps ?

Any idea or hint ?

Hi @Bee10

If you want a job to always run, you can use rules to make that happen:

    - mystage

    stage: mystage
        - when: always
        - echo "This job should always run."

Thanks @snim2 - good idea.

1 Like