They are overwritten. I am using !reference
to add the rules from the template again:
.my_template:
rules:
- if: $FOO != "bar"
when: never
my_job:
extends: .my_template
rules:
- !reference [.my_template, rules] # rules are overwritten, not extended
- if: $SOMETING == "anyting"