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
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
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.