Categories

A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna, tincidunt vitae molestie nec, molestie at mi. Nulla nulla lorem, suscipit in posuere in, interdum non magna.

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 ": java.io.IOException: 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(GitSCM.java:880)
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:812)
at hudson.FilePath$FileCallableWrapper.call(FilePath.java:1899)
at hudson.remoting.UserRequest.perform(UserRequest.java:114)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:270)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at hudson.remoting.Engine$1$1.run(Engine.java:58)
at java.lang.Thread.run(Thread.java:662)

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)
buf.append('"').append(arg).append('"');
else
buf.append(arg);
}

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 ": java.io.IOException: error=2, No such file or directory

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

Leave a Reply