Skip to content

$CI_ENVIRONMENT_SLUG is not set for branches with '#' in the name

Summary

For branches that contain a '#' in the name the $CI_ENVIRONMENT_SLUG is not set, e.g. bugfix#1674

Steps to reproduce

Create a branch with a '#' in the branch name like bugfix#1674

Example Project

Based on the example project for #37302 (closed) I created the repository https://gitlab.com/thklein/ci-env-slug-plus/

This is a working CI with a branch not containing a hash sign: https://gitlab.com/thklein/ci-env-slug-plus/-/jobs/362701320

The the following an example with a branch containing a hash sign: https://gitlab.com/thklein/ci-env-slug-plus/-/jobs/362705352

What is the current bug behavior?

The $CI_ENVIRONMENT_SLUG isn't set

What is the expected correct behavior?

The $CI_ENVIRONMENT_SLUG should be set

Relevant logs and/or screenshots

https://gitlab.com/thklein/ci-env-slug-plus/-/jobs/362713765#L20

20 $ echo '$CI_COMMIT_REF_NAME'
21 $CI_COMMIT_REF_NAME
22 $ echo $CI_COMMIT_REF_NAME
23 ci-env-slug-hash-sign#1674
24 $ echo '$CI_COMMIT_REF_SLUG'
25 $CI_COMMIT_REF_SLUG
26 $ echo $CI_COMMIT_REF_SLUG
27 ci-env-slug-hash-sign-1674
28 $ echo '$CI_ENVIRONMENT_NAME'
29 $CI_ENVIRONMENT_NAME
30 $ echo $CI_ENVIRONMENT_NAME
31 $ echo '$CI_ENVIRONMENT_SLUG'
32 $CI_ENVIRONMENT_SLUG
33 $ echo $CI_ENVIRONMENT_SLUG
38 Job succeeded

Output of checks

This bug happens on GitLab.com