job:variables are not resolved before job:only:variables
### Summary
Assigning a job variable, a value from an environment variable fails to be resolved before the job only variables are evaluated. This prevents the job from being created.
### Steps to reproduce
The following example has two test_jobs. test_job1 explicitly defines the SRC_BRANCH_NAME variable while test_job2 indirectly define the SRC_BRANCH_NAME via a global environment variable ALPHA_BRANCH.
It is expected that both jobs would run; however, only test_job1 runs.
```
variables:
ALPHA_BRANCH: "develop"
stages:
- test
test-job1:
stage: test
variables:
SRC_BRANCH_NAME: 'develop'
CI_DEBUG_TRACE: "true"
script:
- echo "hello"
only:
variables:
- '$CI_COMMIT_REF_NAME== $SRC_BRANCH_NAME'
test-job2:
stage: test
variables:
SRC_BRANCH_NAME: '$ALPHA_BRANCH'
CI_DEBUG_TRACE: "true"
script:
- echo "hello"
only:
variables:
- '$CI_COMMIT_REF_NAME == $SRC_BRANCH_NAME'
```
### What is the current *bug* behavior?
Only one job runs
### What is the expected *correct* behavior?
Both jobs should run
issue