CI pipeline fails if dollar sign is in branch name
Summary
If there's a dollar character / dollar sign ($) in the branch name the CI/CD pipeline fails.
Steps to reproduce
- Create new blank repository
- Add
.gitlab-ci.yml
file with following content
test:
image:
name: alpine:latest
script:
- echo test
- Go to pipelines to ensure the pipeline ran and succeeded.
- Add a new branch with a dollar character in it (e.g.
test-$branch
) - Go to pipelines and check the logs of the latest job.
- It failed with
fatal: couldn't find remote ref refs/heads/test-
Example Project
Repository:
The test-$branch
:
https://gitlab.com/mamiu/test/-/tree/test-$branch
Failed job:
https://gitlab.com/mamiu/test/-/jobs/827352509
What is the current bug behavior?
The job fails right away because it's not able to pull the branch with a dollar name. This is the error message:
fatal: couldn't find remote ref refs/heads/test-
The pipeline treats the dollar symbol and the characters after it as a variable which shouldn't be the case. All other characters are supported. E.g. /
, \
, _
, !
, %
, ✔️
, .
, ,
, 🎉
, etc.
What is the expected correct behavior?
Don't treat the dollar character in branch names as a variable.
Relevant logs and/or screenshots
Output of checks
This bug happens on GitLab.com
Bug investigation log
- 2023:02-18: Setup blank project on GitLab.com and tested the reported scenario.
- 2023:02-18: The job that ran after creating a branch with $ in the branch name ran successfully.
Edited by Darren Eastman