MultiBranch Mercurial JenkinsFile

WARNING; this configuration doesn’t seem to delete old builds. Ever, see; I’ve worked around it by putting the following blurb near the top of my JenkinsFile

properties (
            $class: 'BuildDiscarderProperty',
            strategy: [
                $class: 'LogRotator',
                artifactDaysToKeepStr: '14',
                artifactNumToKeepStr: '3',
                daysToKeepStr: '14',
                numToKeepStr: '3'

This is just a “victory dance” sort of post about setting up a multi-branch build, for a Mercurial project, from a JenkinsFile. When I first tried to do this sthing, I recieved a message reading; ERROR: No configured Mercurial installation which was annoying.

I hadn’t needed to setup Mercurial before, why did I need to now?

Turns out, the workaround/worksforme from here this bug solves the problem by defining the default Mercuiral setup as … the … default?

Step 0; Setup SSH Keys

I don’t know if this is essential, or, what “worksforme” but … I have the Jenkins user using an SSH key with access to my server.

No credentials are stored in Jenkins.

This may or may not be practical; sorry.

Step 1; Define your Mercurial installation

Open Jenkins, Manage Jenkins > Global Tool Configuration / Mercurial / Mercurial installations...

On my Docker container, these settings worked snazzy.


Step 2; Project Setup

Now, you need to add a “Branch Source” to your Multi-Branch Pipeline which uses this Mercuial Installation. The image below illustrates the settings that I used;



That should do it. The next time your project indexes it should be able to scan your repository for branch heads.

Peter LaValle avatar
About Peter LaValle
Peter is currently a PhD student at the University of Nottingham. His day work involves applying functional programming to problems with artificial intelligence. Someday maybe he'll retire and be a graphics programmer or demoscene coder.
comments powered by Disqus