Why does Gitlab on_failure only works if allow_failure is set to false?

,

Hi Team,
I’m trying to set up a GitLab Pipeline which has two stages A and B.

B should execute on_failure but whenever I set allow_failure: true for job A.
it doesn’t execute job B. If I set the allow_failure: false, then my job B gets executed.

Is it the default mechanism of GitLab?

Can anyone please help me with this?
Thanks.

1 Like

Can you add more details about your usecase please ?

Why are you setting allow_failure: true ?

Usecase: manual jobs that won’t prevent merging if not run (default allow_failure: true) but that should trigger a cleanup job in case they are triggered and failed

+1. I have same issue. Any solution?

EDIT: In our case we can use rules and allow_failure: false to specific case.

Usecase: A way to signal to later jobs that they do not need to run. Everything is fine without them.

The same goes with when: on_success. The allow_failure flag makes these useless.

In our case we do some git checks to see if we can avoid the need to trigger a subpipeline. This works great, it’s clear in the UI what happened, lightweight YAML definition, fantastic.

The only trouble is that now the main pipeline is marked as a failure and merge is blocked. The question is why would an allowed failure be considered “success”?