Why does bamboo try to find Mercurial at a Unix location instead of the specified Windows location?

I have a remote agent that is able to build my plan from the command line on the windows 7 box, but when I try to run it from bamboo, it tells me that it can't find Mercurial. I see it in the agent matrix. Mercurial version is 3.1.2. I see in the stack trace that it says /usr/bin/hg could not be started. hg on this windows box lives at c:\Program Files\TortoiseHg. I have added a variable to set system.hg.executable to c:\Program Files\TortoiseHG\hg.exe. I am not sure why it is looking for a unix path instead of the Windows path that I provide in the build plan configuration. 

Vicki 

7 answers

0 vote

Hello Vicki,

Thank you for your question.

Could you go to "Bamboo administration >> Build resources >> Agents >> <your agent> >> Capabilities" tab and please make sure Mercurial capability is pointing to the correct location, please (as you have mentioned C:\Program Files\TortoiseHG\hg.exe instead of /usr/bin/hg).

If you find this answer useful, I would kindly ask you to accept it so the same will be visible to others who might be facing the same issue you have inquired.

Thank you for your understanding.

Kind regards,
Rafael P. Sperafico
Atlassian Support

It is set to the appropriate location: c:\Program Files\TortoiseHg\hg.exe. The exact errors I am seeing in the logs are as follows:

Discover - Discover › DIS-DIS-31 : Errors getting changes for DIS-DIS-31
(com.atlassian.bamboo.repository.RepositoryException : java.lang.RuntimeException: com.atlassian.bamboo.repository.RepositoryException: Mercurial not found. Is Mercurial Executable capability properly set in configuration?)
(13 Jan 2015, 12:17:05 PM)

Hello Vicki, What is the Mercurial version you are running on Windows?

It is Mercurial Distributed ACM (Version 3.1.2) Thanks for any help, Vicki

0 vote

Hello Vicki,

Could you please:

  • attach build log (DIS-DIS-31).


Please, make sure it is running in the agent you have set up Mercurial. You can verify that by opening up the build log and looking at the first two lines. You should find something similar to:

simple	DD-MMM-YYYY HH:II:SS	Build Discover - Discover - Default Job #31 (DIS-DIS-JOB1-31) started building on agent &lt;BAMBOO-AGENT&gt;
simple	DD-MMM-YYYY HH:II:SS	Build working directory is /&lt;bamboo-home&gt;/xml-data/build-dir/DIS-DIS-JOB1
...

 

  • attach an screenshot of "Bamboo administration >> Build resources >> Agents >> <BAMBOO-AGENT> >> Capabilities". (Please, select the <BAMBOO-AGENT> where the build above is being run)

Kind regards,
Rafael P. Sperafico
Atlassian Support

Hello Rafael:

Unfortunately, when I look for the build log, I see the message: No logs were found for this job.

I do see this error:

Discover - Discover › DIS-DIS-31 : Errors getting changes for DIS-DIS-31

(com.atlassian.bamboo.repository.RepositoryException : java.lang.RuntimeException: com.atlassian.bamboo.repository.RepositoryException: Mercurial not found. Is Mercurial Executable capability properly set in configuration?)

(13 Jan 2015, 12:17:05 PM)

 View error details  Clear error from log

Here are the screen shots:

image2015-1-14 11:33:37.pngimage2015-1-14 13.png

0 vote

Hello Vicki,

Is EXP1CIB05.nextgearcapital.com (2) dedicated to Discover - Discover?

When you dedicate an agent to something, nothing else will run on that agent besides what you have dedicated to it.

Screen Shot 2015-01-14 at 2.57.23 PM.png

Could you please go to your Discover - Discover plan configuration and check which agent has the capability to run your build, please. You should have EXP1CIB05.nextgearcapital.com (2) in place of Default Agent.

Kind regards,
Rafael P. Sperafico
Atlassian Support

It shows EXP1CIB05.nextgearcapital.com (2) where you have Default Agent.
Here are the errors I see:
System Error Details
Build Discover - DiscoverCI : Unable to detect changes
(com.atlassian.bamboo.repository.RepositoryException : java.lang.RuntimeException: com.atlassian.bamboo.repository.RepositoryException: Mercurial not found. Is Mercurial Executable capability properly set in configuration?)

Occurrences: 2870
First Occurred: 08 Jan 2015, 2:27:13 PM
Last Occurred: 14 Jan 2015, 2:06:12 PM
com.atlassian.bamboo.repository.RepositoryException: java.lang.RuntimeException: com.atlassian.bamboo.repository.RepositoryException: Mercurial not found. Is Mercurial Executable capability properly set in configuration?
at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceLastBuildInternal(DefaultChangeDetectionManager.java:398)
at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceRevisions(DefaultChangeDetectionManager.java:286)
at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceRevisions(DefaultChangeDetectionManager.java:178)
at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceLastBuildIfTriggered(DefaultChangeDetectionManager.java:116)
at com.atlassian.bamboo.v2.trigger.ChangeDetectionListenerAction.testIfBuildShouldStart(ChangeDetectionListenerAction.java:113)
at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$3.call(PlanExecutionManagerImpl.java:485)
at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$3.call(PlanExecutionManagerImpl.java:469)
at com.atlassian.util.concurrent.ManagedLocks$ManagedLockImpl.withLock(ManagedLocks.java:312)
at com.atlassian.bamboo.plan.PlanExecutionLockServiceImpl.lock(PlanExecutionLockServiceImpl.java:85)
at com.atlassian.bamboo.plan.PlanExecutionManagerImpl.doWithProcessLock(PlanExecutionManagerImpl.java:761)
at com.atlassian.bamboo.plan.PlanExecutionManagerImpl.startConditionalBuild(PlanExecutionManagerImpl.java:468)
at com.atlassian.bamboo.plan.PlanExecutionManagerImpl.start(PlanExecutionManagerImpl.java:539)
at com.atlassian.bamboo.plan.PlanExecutionManagerImpl.start(PlanExecutionManagerImpl.java:556)
at com.atlassian.bamboo.plan.NonBlockingPlanExecutionServiceImpl$3.startPlanExecution(NonBlockingPlanExecutionServiceImpl.java:166)
at com.atlassian.bamboo.plan.NonBlockingPlanExecutionServiceImpl$3$1.run(NonBlockingPlanExecutionServiceImpl.java:145)
at com.atlassian.bamboo.util.CacheAwareness.whileReadingThroughCaches(CacheAwareness.java:85)
at com.atlassian.bamboo.util.CacheAwareness.whileReadingThroughCaches(CacheAwareness.java:102)
at com.atlassian.bamboo.plan.NonBlockingPlanExecutionServiceImpl$3.call(NonBlockingPlanExecutionServiceImpl.java:148)
at com.atlassian.bamboo.plan.NonBlockingPlanExecutionServiceImpl$3.call(NonBlockingPlanExecutionServiceImpl.java:133)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:49)
at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:31)
at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:20)
at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:52)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.RuntimeException: com.atlassian.bamboo.repository.RepositoryException: Mercurial not found. Is Mercurial Executable capability properly set in configuration?
at com.atlassian.bamboo.executor.RetryingTaskExecutor.rerun(RetryingTaskExecutor.java:132)
at com.atlassian.bamboo.executor.RetryingTaskExecutor.runTask(RetryingTaskExecutor.java:88)
at com.atlassian.bamboo.executor.RetryingTaskExecutor.retry(RetryingTaskExecutor.java:191)
at com.atlassian.bamboo.executor.RetryingTaskExecutor.retry(RetryingTaskExecutor.java:176)
at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectionChangesWithRetry(DefaultChangeDetectionManager.java:501)
at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceLastBuildInternal(DefaultChangeDetectionManager.java:358)
... 26 more
Caused by: com.atlassian.bamboo.repository.RepositoryException: Mercurial not found. Is Mercurial Executable capability properly set in configuration?
at com.atlassian.bamboo.plugins.hg.HgCommandProcessor.checkHgExistenceInSystem(HgCommandProcessor.java:132)
at com.atlassian.bamboo.plugins.hg.HgRepositoryAccessImpl.<init>(HgRepositoryAccessImpl.java:89)
at com.atlassian.bamboo.plugins.hg.HgRepository.getHgRepoAccess(HgRepository.java:869)
at com.atlassian.bamboo.plugins.hg.HgRepository.collectChangesSinceLastBuild(HgRepository.java:393)
at com.atlassian.bamboo.plugins.hg.BitbucketRepository.collectChangesSinceLastBuild(BitbucketRepository.java:300)
at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager$2.call(DefaultChangeDetectionManager.java:506)
at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager$2.call(DefaultChangeDetectionManager.java:502)
at com.atlassian.bamboo.executor.RetryingTaskExecutor.rerun(RetryingTaskExecutor.java:108)
... 31 more
Caused by: com.atlassian.bamboo.plugins.hg.HgCommandException: command /usr/bin/hg version --config 'ui.ssh=ssh -o StrictHostKeyChecking=no -o BatchMode=yes' failed. Working directory was `/home/bamboo/xml-data/build-dir'. stderr: stdout:
at com.atlassian.bamboo.plugins.hg.HgCommandProcessor.runCommand(HgCommandProcessor.java:525)
at com.atlassian.bamboo.plugins.hg.HgCommandProcessor.runCommand(HgCommandProcessor.java:490)
at com.atlassian.bamboo.plugins.hg.HgCommandProcessor.checkHgExistenceInSystem(HgCommandProcessor.java:120)
... 38 more
Caused by: com.atlassian.utils.process.ProcessNotStartedException: /usr/bin/hg could not be started
at com.atlassian.utils.process.ExternalProcessImpl.start(ExternalProcessImpl.java:332)
at com.atlassian.utils.process.ExternalProcessImpl.execute(ExternalProcessImpl.java:113)
at com.atlassian.bamboo.plugins.hg.HgCommandProcessor.runCommand(HgCommandProcessor.java:521)
... 40 more
Caused by: java.io.IOException: Cannot run program "/usr/bin/hg" (in directory "/home/bamboo/xml-data/build-dir"): error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1041)
at com.atlassian.utils.process.ExternalProcessImpl.createDefaultProcess(ExternalProcessImpl.java:367)
at com.atlassian.utils.process.ExternalProcessImpl.createProcess(ExternalProcessImpl.java:375)
at com.atlassian.utils.process.ExternalProcessImpl.start(ExternalProcessImpl.java:329)
... 42 more
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:135)
at java.lang.ProcessImpl.start(ProcessImpl.java:130)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1022)
... 45 more
Vicki

Suggest an answer

Log in or Join to answer
Community showcase
Renan Battaglin
Published May 18, 2017 in Bamboo

FAQ: How to Upgrade Bamboo Server

Bamboo 5.9 will no longer be supported after June 12, 2017. What does this mean? As part of our End of Life policy, Atlassian supports major versions for two years after the first major iteratio...

1,095 views 0 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot