Prefilled variables on manual pipelines not working properly with include:rules:if
<!---
Please read this!
Before opening a new issue, make sure to search for keywords in the issues
filtered by the "regression" or "type::bug" label:
- https://gitlab.com/gitlab-org/gitlab/issues?label_name%5B%5D=regression
- https://gitlab.com/gitlab-org/gitlab/issues?label_name%5B%5D=type::bug
and verify the issue you're about to submit isn't a duplicate.
--->
### Summary
When working on [Prefilled variables for manual pipelines](https://docs.gitlab.com/ee/ci/pipelines/index.html#prefill-variables-in-manual-pipelines), variables are not showing properly if exact matching is used in the `include:rules:if` criteria. For example, given the following if conditions, only one of them will work.
```
include:
- local: gitlab-configs/custom-inputs-nonprod.yml
rules:
#- if: $CI_COMMIT_BRANCH == "dev" # will not work
#- if: $CI_COMMIT_BRANCH =~ /^dev$/ # will not work
- if: $CI_COMMIT_BRANCH =~ /dev/ # will work
```
### Steps to reproduce
1. Create a project.
2. Create `gitlab-configs/custom-inputs-nonprod.yml` and set the following.
```
variables:
VARIABLE1:
value: "staging"
options:
- "production"
- "staging"
- "canary"
description: "The deployment target. Set to 'staging' by default."
VARIABLE2:
value: "alpha"
options:
- "alpha"
- "bravo"
- "charlie"
description: "The deployment area. Set to 'alpha' by default."
```
3. Create a `.gitlab-ci.yml` with the following settings.
```
include:
- local: gitlab-configs/custom-inputs-nonprod.yml
rules:
- if: $CI_COMMIT_BRANCH == "dev" # will not work
#- if: $CI_COMMIT_BRANCH =~ /^dev$/ # will not work
#- if: $CI_COMMIT_BRANCH =~ /dev/ # will work
stages: # List of stages for jobs, and their order of execution
- build
build-job: # This job runs in the build stage, which runs first.
stage: build
script:
- echo "Compiling the code..."
- echo "|${CI_COMMIT_BRANCH}|"
```
4. Create a `dev` branch and try manually running the pipeline.
5. Observe that the global variables expected to be prefilled are not visible.
### Example Project
https://gitlab.com/kballon-bug-report/zd585383_prefill_variable_manual_pipeline
### What is the current *bug* behavior?
Prefilled variables are not visible if using exact matching in include:rules:if
### What is the expected *correct* behavior?
Prefilled variables are visible if using exact matching in include:rules:if
### Relevant logs and/or screenshots
- Using exact matching `- if: $CI_COMMIT_BRANCH == "stage"` and `- if: $CI_COMMIT_BRANCH =~ /^stage$/` were tested.

- Using regular expression `if: $CI_COMMIT_BRANCH =~ /dev/`

### Output of checks
<!-- If you are reporting a bug on GitLab.com, uncomment below -->
This bug happens on GitLab.com
<!-- and uncomment below if you have /label privileges -->
<!-- or follow up with an issue comment of `@gitlab-bot label ~"reproduced on GitLab.com"` if you do not -->
#### Results of GitLab environment info
<!-- Input any relevant GitLab environment information if needed. -->
<details>
<summary>Expand for output related to GitLab environment info</summary>
<pre>
(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)
(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
</pre>
</details>
#### Results of GitLab application Check
<!-- Input any relevant GitLab application check information if needed. -->
<details>
<summary>Expand for output related to the GitLab application check</summary>
<pre>
(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:check SANITIZE=true`)
(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true`)
(we will only investigate if the tests are passing)
</pre>
</details>
### Possible fixes
<!-- If you can, link to the line of code that might be responsible for the problem. -->
<!-- If you don't have /label privileges, follow up with an issue comment of `@gitlab-bot label ~"type::bug"` -->
issue