CI/CD jobs: Wrong value in env. variable CI_DEPLOY_USER using <gitlab-deploy-token> deploy token
Summary
As per documentation, there is a special case when it comes to Deploy Tokens:
if a user creates one named
gitlab-deploy-token, the name and token of the Deploy Token will be automatically exposed to the CI/CD jobs as environment variables:CI_DEPLOY_USERandCI_DEPLOY_PASSWORD, respectively.
After creating such a special deploy token, one would expect environment variable CI_DEPLOY_USER to equal Username showed in the repository's settings screen:
In this case, one would expect CI_DEPLOY_USER to equal gitlab+deploy-token-1218 but instead, CI_DEPLOY_USER's value is the name of the token (gitlab-deploy-token).
Steps to reproduce
- In a project, create a token named
gitlab-deploy-tokenwith scoperead_registry(theDeploy Tokensform is available under project'sSettings->Repository) - In a CI/CD job, echo the env. variable
$CI_DEPLOY_USER - Run the job and realize that
$CI_DEPLOY_USER's value isgitlab-deploy-token(the deploy token name) and not the expected username.
Example Project
https://gitlab.com/ssirois/reproducible-bug-on-deploy-token_ci-deploy-user/
You can also see an output in the job's output:
https://gitlab.com/ssirois/reproducible-bug-on-deploy-token_ci-deploy-user/-/jobs/68777865
Env. Variable Expected Value Actual Value
CI_DEPLOY_USER gitlab+deploy-token-1218 gitlab-deploy-token
What is the current bug behavior?
CI_DEPLOY_USER's value is gitlab-deploy-token instead of expected username (gitlab_deploy-token-1218).
What is the expected correct behavior?
CI_DEPLOY_USER's value should be gitlab+deploy-token-1218 instead of erroneous deploy token name (gitlab-deploy-token)
Relevant logs and/or screenshots
Output of checks
This bug happens on GitLab.com
/label ~bug
