Mercurial plugin: Cannot run program "hg": error=2, No such file or directory

1,395 views
Skip to first unread message

Chuck Doucette

unread,
Apr 10, 2012, 7:03:26 PM4/10/12
to jenkins...@googlegroups.com
We *just* switched from Subversion to Mercurial.
I didn't get a chance to test Jenkins on Mercurial before making the switch.
Now - I am unable to start any builds.
They all fail with the error above.

FYI - I am running Jenkins 1.459 on a Mac (Snow Leopard 10.6) w/ the Mercurial plugin 1.38.

Here's a full snippet from the console output:


$ hg clone --rev default --noupdate http://perforce.mok3.com/scm/hg/EveryScape /Users/Shared/Jenkins/Home/jobs/ESSDK/workspace
ERROR: Failed to clone http://perforce.mok3.com/scm/hg/EveryScape
java.io.IOException<http://stacktrace.jenkins-ci.org/search?query=java.io.IOException>: Cannot run program "hg": error=2, No such file or directory

When I execute the same command outside of Jenkins, it works fine:

macmini_05:~ cruisecontrol$ hg clone --rev default --noupdate http://perforce.mok3.com/scm/hg/EveryScape /Users/Shared/Jenkins/Home/jobs/ESSDK/workspace
adding changesets
adding manifests

In the Jenkins configuration, under Mercurial, I have:

Installation directory: /usr/local/bin
Executable: /usr/local/bin/hg

From the shell, I can find hg:

macmini_05:~ cruisecontrol$ which hg
/usr/local/bin/hg

I happened to notice this resolved issue which may fix my problem:

https://issues.jenkins-ci.org/browse/JENKINS-11877

Unfortunately, this issue is not bundled into a plugin release yet.

Also - I attempted to fetch the source code for this plugin and build a copy myself;
however, the build was unsuccessful (apparently due to some tests failing).

How can I resolve my problem in the meantime?

Thanks,
Chuck

Chuck Doucette

unread,
Apr 11, 2012, 5:54:21 PM4/11/12
to jenkins...@googlegroups.com, Matt Dunn
One of my colleagues helped solve this problem.

It appears to me that:


1. Even if you specify the full path to the Mercurial executable in the Mercurial plugin configuration - it is not used.
2. Explicitly setting the environment variable PATH in Global properties also appears to have no affect.

Once we examined the actual path used in System Information -> Environment Variables, and we created a symbolic link from /usr/bin/hg (a directory in Jenkins runtime path) to the actual installation path, the Mercurial plugin (and my project) worked fine.

Chuck

Reply all
Reply to author
Forward
0 new messages