Usage of variables in only: changes: paths
### Clarification
:exclamation: The CI/CD variables are [supported](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/45037) for [`rules:changes`](https://docs.gitlab.com/ee/ci/yaml/#ruleschanges) and we advice users to migrate to the new syntax because the `only` and `except` keywords are [deprecated](https://docs.gitlab.com/ee/ci/yaml/#only--except).
### Summary
Variable substitution does not work on CI/CD configs
### Steps to reproduce
Try to make use of a variable within a `only: changes: ` block
```yaml
variables:
SERVICE_PATH: "services/gitlab-builder-k8s"
gitlab-builder-k8s:
image: $DOCKER_REGISTRY/gitlab-builder-docker:0.0.5
script:
- docker build -t $DOCKER_REGISTRY/$SERVICE_NAME:$SERVICE_VERSION -t $DOCKER_REGISTRY/$SERVICE_NAME:latest -f $SERVICE_PATH/Dockerfile $SERVICE_PATH
only:
changes:
# - services/gitlab-builder-k8s/* works
- $SERVICE_PATH/* # does not work
```
### Example Project
We are on prem.
### What is the current *bug* behavior?
The build does not get triggered
### What is the expected *correct* behavior?
The build gets triggered
### Relevant logs and/or screenshots
### Output of checks
The bug happens on on prem Gitlab with version `11.4.0-ee.0`
#### Results of GitLab environment info
<details>
<summary>Expand for output related to GitLab environment info</summary>
<pre>
System information
System:
Proxy: no
Current User: git
Using RVM: no
Ruby Version: 2.4.4p296
Gem Version: 2.7.6
Bundler Version:1.16.2
Rake Version: 12.3.1
Redis Version: 3.2.12
Git Version: 2.18.1
Sidekiq Version:5.2.1
Go Version: unknown
GitLab information
Version: 11.4.0-ee
Revision: cfe266c
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: postgresql
DB Version: 9.6.8
URL: <REMOVED>
HTTP Clone URL: <REMOVED>
SSH Clone URL: <REMOVED>
Elasticsearch: no
Geo: no
Using LDAP: no
Using Omniauth: yes
Omniauth Providers:
GitLab Shell
Version: 8.3.3
Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories
Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks
Git: /opt/gitlab/embedded/bin/git
</pre>
</details>
#### Results of GitLab application Check
<details>
<summary>Expand for output related to the GitLab application check</summary>
<pre>
Checking GitLab Shell ...
GitLab Shell version >= 8.3.3 ? ... OK (8.3.3)
Repo base directory exists?
default... yes
Repo storage directories are symlinks?
default... no
Repo paths owned by git:root, or git:git?
default... yes
Repo paths access is drwxrws---?
default... yes
hooks directories in repos are links: ...
5/2 ... ok
5/3 ... ok
7/4 ... ok
5/5 ... ok
6/7 ... ok
5/8 ... ok
5/9 ... ok
20/11 ... ok
5/12 ... ok
5/13 ... ok
5/14 ... ok
5/15 ... ok
6/17 ... ok
26/18 ... ok
20/19 ... repository is empty
20/24 ... ok
23/26 ... repository is empty
7/27 ... ok
6/28 ... ok
7/29 ... ok
7/30 ... ok
6/31 ... ok
7/32 ... ok
6/33 ... ok
7/34 ... repository is empty
15/36 ... ok
6/37 ... ok
6/38 ... repository is empty
5/39 ... ok
20/40 ... ok
20/41 ... repository is empty
33/42 ... ok
7/46 ... ok
26/47 ... ok
5/50 ... ok
20/54 ... ok
13/55 ... ok
26/56 ... ok
34/57 ... ok
26/58 ... ok
5/59 ... ok
26/60 ... ok
20/61 ... ok
26/62 ... ok
20/64 ... ok
20/65 ... repository is empty
12/67 ... ok
14/68 ... repository is empty
26/69 ... ok
5/70 ... ok
5/71 ... ok
46/72 ... repository is empty
46/73 ... ok
27/74 ... ok
Running /opt/gitlab/embedded/service/gitlab-shell/bin/check
Check GitLab API access: OK
Redis available via internal API: OK
Access to /var/opt/gitlab/.ssh/authorized_keys: OK
gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... yes
Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Reply by email is disabled in config/gitlab.yml
Checking LDAP ...
LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab ...
Git configured correctly? ... yes
Database config exists? ... yes
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config up to date? ... yes
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory exists? ... yes
Uploads directory has correct permissions? ... yes
Uploads directory tmp has correct permissions? ... 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: ...
5/2 ... yes
5/3 ... yes
7/4 ... yes
5/5 ... yes
6/7 ... yes
5/8 ... yes
5/9 ... yes
20/11 ... yes
5/12 ... yes
5/13 ... yes
5/14 ... yes
5/15 ... yes
6/17 ... yes
26/18 ... yes
20/19 ... yes
20/24 ... yes
23/26 ... yes
7/27 ... yes
6/28 ... yes
7/29 ... yes
7/30 ... yes
6/31 ... yes
7/32 ... yes
6/33 ... yes
7/34 ... yes
15/36 ... yes
6/37 ... yes
6/38 ... yes
5/39 ... yes
20/40 ... yes
20/41 ... yes
33/42 ... yes
7/46 ... yes
26/47 ... yes
5/50 ... yes
20/54 ... yes
13/55 ... yes
26/56 ... yes
34/57 ... yes
26/58 ... yes
5/59 ... yes
26/60 ... yes
20/61 ... yes
26/62 ... yes
20/64 ... yes
20/65 ... yes
12/67 ... yes
14/68 ... yes
26/69 ... yes
5/70 ... yes
5/71 ... yes
46/72 ... yes
46/73 ... yes
27/74 ... yes
Redis version >= 2.8.0? ... yes
Ruby version >= 2.3.5 ? ... yes (2.4.4)
Git version >= 2.9.5 ? ... yes (2.18.1)
Git user has default SSH configuration? ... yes
Active users: ... 32
Elasticsearch version 5.1 - 5.5? ... skipped (elasticsearch is disabled)
Checking GitLab ... Finished
</pre>
</details>
### Possible fixes
(If you can, link to the line of code that might be responsible for the problem)
issue