Jump step on fail

I have a pipeline with some steps.
I need to “jump” to the last step if one of the previous steps fails. (not manually)

How I can configure this on my gitlab-ci.yml ?


create_change_request → build → deploy → close_change_request

create_change_request → build|FAIL → close_change_request

If I am not mistaken the allow_failure keyword will help with this?

yes, but allow_failure just continues the step, I need to condition to jump to the last step on failure

allow_failure for the one step, when: always for the last step, and when: on-success for all the intermediate steps should do it.

Maybe “after_script” job can help you.

You can set it globally or a per job basis and it executes even for failed jobs.

Hope it helps!