How to use allow_failure:exit_codes in rules?

Hello,
how can allow_failure:exit_codes be used inside keyword rules?

I only noticed that it is possible to add true/false to allow_failure in the rules, but it does not allow me to add exit_code there, like that:

rules:
   - if: ...
     allow_failure:
       exit_codes: 111 

Is it even possible to do it somehow within the rules? Because as I understand it, there is an implicit allow_failure: false in the rules and that overrides the allow_failure that is defined for the whole job, so when I have:

job:
  rules:
     - if: ...
  allow_failure:
     exit_codes: 111

Then the rule-level rule rules:allow_failure overrides the allow_failure value at the job level and is only applied when a particular rule starts a job, and if allow_failure is not defined, rules defaults to `false’, which means that will the entire job have allow_failure:false if rules is triggered?

Hello to everybody!
I solved my problem, it was because I didn’t understand how allow_failure works on the rules level and on the jobs level.
I found out that if allow_failure is not defined in the rules, then it takes the value from allow_failure at the job level, and if there is no allow_failure at the job level, then the default value from the rules case is taken.
So, just put it this way:

job:
  rules:
     - if: ...
  allow_failure:
     exit_codes: 111
1 Like