Skip to content

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

  1. Create new blank repository
  2. Add .gitlab-ci.yml file with following content
test:
  image:
    name: alpine:latest
  script:
    - echo test
  1. Go to pipelines to ensure the pipeline ran and succeeded.
  2. Add a new branch with a dollar character in it (e.g. test-$branch)
  3. Go to pipelines and check the logs of the latest job.
  4. It failed with fatal: couldn't find remote ref refs/heads/test-

Example Project

Repository:

https://gitlab.com/mamiu/test

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

Screen_Shot_2020-10-31_at_12.26.04

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.

Screenshot_2023-02-18_at_7.36.43_AM

Edited by Darren Eastman