Problem with variable expansion from variable in environment url definition
### Summary Variables that use other variables are not expanded if used in environment but are expanded as environment variables. I'm using some variables (defined from project or from .gitlab-cy.yml) to define the URL for environments. I tried using other variables in those variables and those are expanded correctly at shell level. They are not expanded but used as is ($VARIABLE) in the environment URL resulting in a wrong url. The environment on which I had the problem is gitlab-ee 8.16.0. ### Steps to reproduce Use this CI script. testko is the test reporting an error (using local defined variables). testok is the same working (using global variables) ``` variables: PRODSERVER: server2.my.domain WEBAPPNAME: WebApp.$CI_BUILD_REF_SLUG testko: stage: deploy variables: DEPLOYSERVER: $PRODSERVER environment: name: test_ko url: http://$DEPLOYSERVER/$WEBAPPNAME script: - env testok: stage: deploy environment: name: test_ok url: http://$PRODSERVER/WebApp.$CI_BUILD_REF_SLUG script: - env ``` ### Expected behavior Those are the expected value: ``` test_ko URL: http://server2.my.domain/WebApp.fduranti-nuova-feature test_ok URL: http://server2.my.domain/WebApp.fduranti-nuova-feature ``` ### Actual behavior Those are the result I'm getting. ``` test_ko URL(wrong): http://$prodserver/WebApp.$CI_BUILD_REF_SLUG test_ok URL(correct): http://server2.my.domain/WebApp.fduranti-nuova-feature ``` The env command result give those: ``` WEBAPPNAME=WebApp.fduranti-nuova-feature PRODSERVER=server2.my.domain DEPLOYSERVER=server2.my.domain ``` #### Results of GitLab environment info sudo gitlab-rake gitlab:check SANITIZE=true ``` Checking GitLab Shell ... GitLab Shell version >= 4.1.1 ? ... OK (4.1.1) Repo base directory exists? default... yes Repo storage directories are symlinks? default... no Repo paths owned by git:git? default... yes Repo paths access is drwxrws---? default... yes hooks directories in repos are links: ... 3/3 ... ok 3/4 ... ok 3/8 ... ok 3/9 ... ok 3/10 ... ok 3/13 ... ok 3/14 ... ok 3/15 ... ok 3/16 ... ok 3/17 ... ok 6/18 ... ok 10/19 ... ok 3/21 ... ok 8/22 ... ok 8/24 ... ok 10/26 ... ok 13/29 ... ok 15/30 ... ok 10/31 ... ok 10/32 ... ok 10/33 ... ok 15/34 ... ok 6/35 ... ok 10/36 ... ok 10/37 ... ok 13/38 ... ok 21/41 ... ok 21/42 ... ok 21/43 ... ok 21/44 ... ok 21/45 ... ok 15/48 ... ok 22/49 ... ok 22/50 ... ok 6/51 ... ok 6/52 ... ok Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: OK Access to /var/opt/gitlab/.ssh/authorized_keys: OK Send ping to redis server: OK gitlab-shell self-check successful Checking GitLab Shell ... Finished Checking Sidekiq ... Running? ... yes Number of Sidekiq processes ... 1 Checking Sidekiq ... Finished Checking Reply by email ... IMAP server credentials are correct? ... yes Init.d configured correctly? ... skipped (omnibus-gitlab has no init script) MailRoom running? ... can't check because of previous errors Checking Reply by email ... Finished Checking LDAP ... Server: ldapmain LDAP authentication... Success LDAP users with access to your GitLab server (only showing the first 100 results) Server: ldapsecondary LDAP authentication... Success LDAP users with access to your GitLab server (only showing the first 100 results) Checking LDAP ... Finished Checking GitLab ... Git configured with autocrlf=input? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config outdated? ... no Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory setup correctly? ... yes Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) projects have namespace: ... 3/3 ... yes 3/4 ... yes 3/8 ... yes 3/9 ... yes 3/10 ... yes 3/13 ... yes 3/14 ... yes 3/15 ... yes 3/16 ... yes 3/17 ... yes 6/18 ... yes 10/19 ... yes 3/21 ... yes 8/22 ... yes 8/24 ... yes 10/26 ... yes 13/29 ... yes 15/30 ... yes 10/31 ... yes 10/32 ... yes 10/33 ... yes 15/34 ... yes 6/35 ... yes 10/36 ... yes 10/37 ... yes 13/38 ... yes 21/41 ... yes 21/42 ... yes 21/43 ... yes 21/44 ... yes 21/45 ... yes 15/48 ... yes 22/49 ... yes 22/50 ... yes 6/51 ... yes 6/52 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.1.0 ? ... yes (2.3.3) Your git bin path is "/opt/gitlab/embedded/bin/git" Git version >= 2.7.3 ? ... yes (2.10.2) Active users: 10 Checking GitLab ... Finished ```
issue