We’ve been looking at ways of optimising our branching strategy and wanted to accomplish the following using the allow_failure option:
When a branch includes the name ‘feature’ or ‘spike’ then the step unit_tests is allowed to fail, otherwise unit_tests needs to pass for the pipeline to continue.
I came across the rules option and have been trying this method out as per the below screenshot:
Tested the above code by creating a branch and naming it feature/xxxx and the allow_failure rule worked a treat, also tested by naming a branch test/xxxx which also worked as expected.
However, when trying to create a merge request I am getting the ‘detached’ tag showing and the merge pipeline fails only showing the unit_tests stage (when in reality we have 8 stages; npm_install etc - these are all templates)
Am I using rules in the correct way, or is there a better way of going about this? i.e. an alternative method
Any guidance greatly appreciated!
NOTE: We are using our own hosted version of Gitlab and are on version 12.9.2