Details
-
Bug
-
Status: Resolved (View Workflow)
-
Major
-
Resolution: Not A Defect
-
None
-
Jenkins 2.73.1
Mercurial 2.1
Pipeline 2.5
Description
The mercurial plugin cannot find mercurial installation when multibranch pipeline configuration.
In the logs it says:
{{[Thu Sep 21 20:56:18 UTC 2017] Starting branch indexing... }}
{{ERROR: No configured Mercurial installation }}
{{[Thu Sep 21 21:15:36 UTC 2017] Finished branch indexing. Indexing took 19 min }}
Finished: SUCCESS
It appears that multibranch pipeline uses MercurialSCMSource.retrieve method. The code exempt that I analyzed is below:
try (MercurialSCMSourceRequest request= new MercurialSCMSourceContext<>(criteria, observer).withCredentialsId(credentialsId).withTraits(traits).newRequest(this, listener) ) {
MercurialInstallation inst = MercurialSCM.findInstallation(request.installation());
if (inst == null) {
listener.error("No configured Mercurial installation");
return;
{{ }}}
In that code, it appears that the MercurialSCMSourceContext never has "installation" field initialized. MercurialSCMSourceRequest (request) gets its installation from the context, thus it is always null in that trace. The next line MercurialSCM.findInstallation will be called with a null parameter, and it always returns null in that case. It appears that inst is always null and we always get "No configured Mercurial installation", even though we have.
A quick fix without much change would be to alter MercurialSCM.findInstallation. If the parameter of findInstallation is null, then return any mercurial installation. I think this will not violate any contracts of the method.
A better fix would be to alter the multibranch pipeline so that mercurial scm accepts installation argument, and pass that configuration to the findInstallation method. I am not that sure whether this modification violates any existing configurations.