You push code late at night, the build kicks off, and GitLab CI yells at your Mercurial repo like it doesn’t speak the same language. It’s a classic identity mismatch: one side speaks Git; the other speaks history preserved in changesets. Yet, these two can actually cooperate—if you give them a shared sense of who’s asking for what.
GitLab CI is a runner-driven automation engine that excels at pipelines, permissions, and traceability. Mercurial is a version control system built around atomic changes and simpler branching, still beloved in research and large monorepo environments. Their integration shines when you treat source verification and access identity as a single workflow instead of two disjointed chores.
To make GitLab CI Mercurial integration click, start by mapping the CI’s runner tokens to real Mercurial user credentials through OIDC or SSH key management. The idea isn’t to “Gitify” Mercurial—it’s to teach GitLab CI how to pull, test, and push without violating repo integrity. Each pipeline job should authenticate via ephemeral credentials that expire automatically. Tie those credentials to your team’s IAM or SSO system, like Okta or AWS IAM, for consistent audit trails.
A common mistake is treating Mercurial’s clone and push commands like Git equivalents. They’re not; they rely on a different metadata model. Use a clean workspace for each job, avoid shared .hg directories, and confirm that CI runners clean up temporary states after builds. That stops stale lock files and reduces pipeline latency.
Quick answer: To connect Mercurial with GitLab CI, configure your CI runner with Mercurial installed, authenticate via tokens tied to your identity provider, and fetch repositories using secure SSH or HTTPS URLs managed by CI variables. This keeps credentials short-lived and auditable for compliance.