Mercurial environment variables for non-branch pipelines
I've noticed that CI_COMMIT_HG_BRANCH
and similar environment variables are available only for branch pipelines, e.g. notably not "detached" MR pipelines nor tag pipelines.
This lead to some niceties like empty Docker tags or using wrong dependencies. This can often be worked around, e.g., by introducing dedicated match patterns against target GitLab branches in Merge Requests, but that is a bit fuzzy and painful to do.
While it makes sense to consider CI_COMMIT_BRANCH
to be a fuzzy heuristic at best, and not a cheap one either, it is a clear advantage of Mercurial named branches to be always unambiguously available.
I've go the strong feeling that this has changed with recent GitLab versions.