Allow default value for variables
## Description
Allow variables defined global or on job level to have a default value as for example:
Using the `${MY_VAR:-default_value}` pattern (Inspired by https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html)
This would allow people to fork a project and enable their own `CI_REGISTRY` and propose new Docker images and/or a new `Dockerfile`. But for people which do not enable their registry, using `$CI_REGISTRY_IMAGE` will be an empty string, so in merge requests the build will always fail.
## Bash examples
```bash
echo ${VAR1:-default}
# => default
echo ${VAR1:-$VAR2}
# =>
export VAR2=hello
echo ${VAR1:-$VAR2}
# => hello
export VAR1=thisisvar1
echo ${VAR1:-$VAR2}
# => thisisvar1
```
## Proposal
Example `.gitlab-ci.yml`:
```yaml
build:
image: ${CI_REGISTRY_IMAGE:-registry.gitlab.com/daniel.widerin/testproject}:build
script:
- echo "run fancy stuff..."
```
### Implementation
| Work Type | Description | Issue link |
| ------ | ------ | ------ |
| ~backend | Allow setting a default value for a variable in the `include:ref` field | https://gitlab.com/gitlab-org/gitlab/-/issues/351094 |
| ~backend | Allow setting a default value for a variable in the `cache_key:` field | https://gitlab.com/gitlab-org/gitlab/-/issues/351093 |
| ~backend | Allow setting a default value for variables in variables: field | https://gitlab.com/gitlab-org/gitlab/-/issues/351092 |
| ~backend | Allow default value for variables in `image:` field | https://gitlab.com/gitlab-org/gitlab/-/issues/351091 |
epic