ci: Add CI_MERGE_REQUEST_*_SLUG and CI_PROJECT_NAME_SLUG variables
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
📝 Summary
This feature proposal introduces two new sets of variables to the GitLab CI pipeline syntax:
-
Branch Slugs:
CI_MERGE_REQUEST_TARGET_BRANCH_SLUGandCI_MERGE_REQUEST_SOURCE_BRANCH_SLUG -
Project Name Slug:
CI_PROJECT_NAME_SLUG
These variables will enhance flexibility and consistency in CI/CD pipelines by providing URL-safe slugs for branch names and project names.
💡 Motivation
This proposal is driven by the remarkable work already done by previous contributors, particularly @olliver.schinagl and @dbiryukov. Their efforts in MR !142371 and MR !144354 laid a solid foundation for the branch slug variables. It would be a shame to let their hard work go unnoticed or unfinished. My primary motivation is to honor and build upon their contributions, ensuring that this valuable feature makes it into the hands of the community.
Kudos to everyone involved! This contribution aims to carry forward their efforts and bring these features to fruition.
📚 Background
🔗 Branch Slugs
The branch slug variables were initially proposed in:
- Issue #438861 : Missing slugs for CI_MERGE_REQUEST_SOURCE_BRANCH_NAME CI_MERGE_REQUEST_TARGET_BRANCH_NAME etc
- Issue #215273 (closed) : Target branch slug variable in merge request jobs
These issues have garnered significant community support. The groundwork for these features was laid by @olliver.schinagl and @dbiryukov in:
- MR !142371 (closed) : Offer slugs of merge request branch names (by @olliver.schinagl)
- MR !144354 (closed) : Offer slugs of merge request branch names (by @dbiryukov)
This proposal seeks to complete, refine and implement their work.
🏷️ Project Name Slug
The idea for the CI_PROJECT_NAME_SLUG variable surfaced in issue #467366. This addition will help streamline pipeline configuration by providing a consistent and predictable variable for the project name.
🚧 Roadmap
✅ Completed Tasks
-
🌿 ImplementedCI_MERGE_REQUEST_TARGET_BRANCH_SLUGandCI_MERGE_REQUEST_SOURCE_BRANCH_SLUG:
🚧 Ongoing Work
-
📛 InvestigatingCI_PROJECT_NAME_SLUG:- The implementation is still under investigation.
-
Support Needed:
- Guidance from experienced contributors is appreciated, as the process for setting this variable seems to differ from how other CI variables are handled.
🛠️ Testing Environment
The features were tested using GitLab GDK on a local machine, as it provided a reliable environment for attaching runners and simulating real-world scenarios.
👥 Request for Feedback
This ticket serves to merge and update previous related issues, providing a clear and organized record of the development process. Your feedback and insights are welcome to ensure the successful implementation of these features.

