How to set gitlab Pipeline status as failed if any of stage got failed

I have created a gitlab pipeline, in which I have created 8 stages. For each stage I have set the property Allow_failure:true so that it will execute remaining stages even if any stage got failed.

Currently, if any stage got failed, then the final pipeline status is showing as " ! passed ". I want to execute all the stages of the pipeline and if any stage got failed then I want to display pipeline status as failed.

Note: I can’t change the value of property Allow_failure.

Please find attached Image for your reference.

The most simply approach to reach that goal is:
Add a last job which always fails e.g.:
if you’re running on Linux Host: touch /hello.txt
The kind of script/job depends on your pipeline, but this is the most simple way to achieve that.


Thanks for the reply.
I have added the new stage “.post” in the pipeline to achieve the same.

# Update Pipeline Status

  stage: .post
  script: ....