Hudson, Git and the extra space

At work I am installing a new Hudson slave for continuous integration. Everything works great, using the Tanuki Java Service Wrapper to fire up the slave.jar, but when it comes time to run the build, it fails:

Started by user anonymous
Building remotely on warehouse_build_slave
Checkout:WarehousePortal_Rake / /var/hudson/workspace/WarehousePortal_Rake - hudson.remoting.Channel@26c81672:warehouse_build_slave
Using strategy: Default
Checkout:WarehousePortal_Rake / /var/hudson/workspace/WarehousePortal_Rake - hudson.remoting.LocalChannel@1e9b7b2
Cloning the remote Git repository
Cloning repository origin
ERROR: Error cloning remote repo 'origin' : Could not clone ssh://XXXXXX.XXX/git/projectname
ERROR: Cause: Error performing command: /usr/local/bin/git clone -o origin ssh://XXXXXXX.XXX/git/projectname /var/hudson/workspace/projectname_rake
Cannot run program "/usr/local/bin/git ": error=2, No such file or directory
Trying next repository
ERROR: Could not clone repository
FATAL: Could not clone
hudson.plugins.git.GitException: Could not clone
at hudson.plugins.git.GitSCM$2.invoke(
at hudson.plugins.git.GitSCM$2.invoke(
at hudson.FilePath$
at hudson.remoting.UserRequest.perform(
at hudson.remoting.UserRequest.perform(
at hudson.remoting.Request$
at java.util.concurrent.Executors$
at java.util.concurrent.FutureTask$Sync.innerRun(
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(
at java.util.concurrent.ThreadPoolExecutor$
at hudson.remoting.Engine$1$

Lots of Googling. Pulled down the source for Hudson, opened in Eclipse. Pulled down the Git plugin source. Reviewed the setup with other Hudson slaves. Looks great. But it doesn’t work.

Run /usr/local/bin/git clone -o origin ssh://XXXXXXX.XXX/git/projectname /var/hudson/workspace/projectname_rake from the shell. Works great.

Permissions good. Using /usr/local/bin/git to launch. Replaced with a shell script and could echo out some stuff. The dang thing is running!

Finally poking around in hudson.Util.ArgumentListBuilder.
if(arg.indexOf(' ')>=0 || arg.length()==0)

Oh no. If there is a space in the program name it will double quote it.

Open Manage Hudson, Configure System. Check the git “Path to Git executable”. It is “/usr/local/bin/git ” with a space at the end. Just like in the log:
Cannot run program "/usr/local/bin/git ": error=2, No such file or directory

Remove the space. Fixed. 3 hours I will never get back.

This entry was posted in Computers, Software. Bookmark the permalink.

Leave a Reply