Introduce $CI_BUILD_REF_SLUG
What does this MR do?
Adds $CI_BUILD_REF_SLUG
to the variables exposed to the runner. This is based on $CI_BUILD_REF_NAME
but lowercased, shortened to 63 bytes maximum, and with characters invalid in URLs and domain names replaced with -
.
Are there points in the code the reviewer needs to double check?
Slugs don't have a uniqueness guarantee. !7983 (merged) introduces an environment name slug which is unique, so I'm not as exercised about this as I was.
Should the slug be published in the API? It's available through the variables
endpoint, but perhaps it should be part of GET /project/:id/builds
?
I've called it ref_slug
rather than just slug
as there are number of possibilities for slugification in a build (unlike an environment, where only the name makes sense to slugify).
Why was this MR needed?
$CI_BUILD_REF_NAME
is not suited for URLs and domain names, given the list of valid characters in a git ref.
Screenshots (if relevant)
Does this MR meet the acceptance criteria?
-
Changelog entry added -
Documentation created/updated -
API support added - Tests
-
Added for this feature/bug -
All builds are passing
-
-
Conform by the merge request performance guides -
Conform by the style guides -
Branch has no merge conflicts with master
(if it does - rebase it please) -
Squashed related commits together
What are the relevant issue numbers?
Closes #22849 (closed)