Determine environment attributes earlier in the pipeline creation process
Problem to solve
From https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/6684:
The problem is that some variables in combination with environments depend on other variables. 1) We allow to use variables with environment name, to expand the name. 2) We depend on variables being in a correct order. 3) We depend on variables being evaluated before creating an environment. 4) We depend on some variables being available after creating an environment. 5) We do have environment-scoped variables too etc.
[...] I think it is clear by now that we need to refactor variables again (we already have completed a few refactorings). We need to somehow untangle predefined variables and environments and this is going to be difficult, but is doable.
Proposal
Generate environment slug before evaluating only
/except
rules
Links / references
https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/6684#note_100399125 https://gitlab.com/gitlab-org/gitlab-ce/issues/52494#note_189618070