Pipeline error for ineffectual variable declarations
Description
Variables defined in .gitlab-ci.yml
have lower precedence than their counterparts configured for the instance/group/project. Although this behavior seems unintuitive, I can see why this is the case. However, it can be very confusing to debug a pipeline with variables defined in .gitlab-ci.yml
that get overwritten by instance/group/project-level variables.
Proposal
It's erroneous to define variables in .gitlab-ci.yml
that are also defined at the instance/group/project-level as they will always be overruled by design. I therefore propose that defining such variables will result in a pipeline error in order to clearly communicate to the developer what's happening.
Edited by Michiel Crefcoeur