Inability to use environment variables under Windows in .gitlab-ci.yml environment.name for CI/CD Environments
Summary
Impossible to use Windows environment variable under the environment.name
in .gitlab-ci.yml
for CI/CD Environments
Steps to reproduce
- To use environment variable in Windows, the syntax is the following: %ENV_VAR_NAME%
- In a
.gitlab-ci.yml
file, add theenvironment
section with aname
using a Windows environment variable - Try to validate that file in the CI Lint on GitLab.
Example Project
buildanddeploy:
stage: deploy
script:
- call deployIt
environment:
name: review/%CI_COMMIT_REF_NAME%
url: https://%CI_ENVIRONMENT_SLUG%.mywebsite.com
only:
- branches
except:
- master
- development
What is the current bug behavior?
The linter does not accept the '%' character blocking usage of environment variables under Windows.
The linter returns the following error:
Status: syntax is incorrect
Error: jobs:buildanddeploy:environment name can contain only letters, digits, '-', '_', '/', '$', '{', '}', '.', and spaces
What is the expected correct behavior?
The linter should accept '%' in the name
& url
so that we may use environment variables under Windows.
Output of checks
This bug happens on GitLab.com & on-premise.
Edited by Jason Yavorska