This is a workaround until Gitlab fix this problem.
If you add a temp job which always resolves to false in gitlab-ci.yml then this fixes the problem. e.g.
gitlab-ci.yml
temp: script: echo rules: - if: $EMPTY_VAR # Always false