Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get CruiseControl to talk to github with the correct public key

Has anybody installed git and ControlControl and got CruiseControl to pull from GitHub on a window 2003 server.

I keep getting 'public key errors (access denied)' - Which is good i suppose as that confirms git is talking to GitHub.
However what is not good is that I don't not know where to install the rsa keys so they will be picked up by the running process (git in the context of cc.net).

Any help would save me a lot of hair!

I have tried installing the keys into;

c:\Program Files\Git.ssh 

Whereby running git bash and cd ~ take me to: c:\Program Files\Git

Current error from CC.net is Error Message:

ThoughtWorks.CruiseControl.Core.CruiseControlException:  
  Source control operation failed: Permission denied (publickey). fatal: 
  The remote end hung up unexpectedly . 
  Process command: C:\Program Files\Git\bin\git.exe fetch origin

Thanks in advance

like image 849
Danny Lister Avatar asked May 10 '10 10:05

Danny Lister


1 Answers

Here's my notes for getting CruiseControl.net to work with a github repository (on Windows). I'm running msysgit 1.7.3.1 on Windows 7. I set up ccnet to run as a service.

The strategy I follow is create a user account that the ccnet service will use. Start by getting the build to work logged in as that user running the cruise control console. After that works, I setup the service account to run using that user account.

First, setup your SSH keys for that user just as you would another user. Do not, however, use a passphrase. That will cause ccnet to timeout waiting on user input. (github ssh key management has help, http://help.github.com/msysgit-key-setup/)

You'll also need to clone the repro somewhere while logged in that user. A list of trusted hosts is kept, this ensures the host is on that list (I think with your .ssh keys). If its not on the list, cruisecontrol will timeout as git waits for you to say if you trust the host.

Grant the user read/write permissions to the folder where cruise control is installed. Also give the user permissions to edit whatever build folders you use, whatever resources your build may need to access.

The cruise control config file will need to use a git sourcecontrol block.
Here's the docs on that block. Here's a sample:

<project name="NJasmine">

    <sourcecontrol type="git">
        <repository>git://github.com/fschwiet/DreamNJasmine.git</repository>
        <branch>master</branch>
        <autoGetSource>true</autoGetSource>
        <executable>$(gitpath)</executable>
        <tagOnSuccess>false</tagOnSuccess>
        <commitBuildModifications>false</commitBuildModifications>
        <commitUntrackedFiles>false</commitUntrackedFiles>
        <workingDirectory>c:\build\NJasmine.git</workingDirectory>
        <timeout>60000</timeout>
    </sourcecontrol>
    ...
</project>

You'll notice I use a variable for the gitPath, that way I only define it once. My main ccnet config file actually references the above, it looks something like the below. By referencing an external config file, I can keep most of my ccnet config in source control:

<!DOCTYPE cruisecontrol [
    <!ENTITY njasmine SYSTEM "file:c:\src\njasmine\ccnet.config.xml">
]>
<cruisecontrol xmlns:cb="urn:ccnet.config.builder">

    <cb:define gitpath="C:\Program Files (x86)\Git\cmd\git.cmd"/>

    &njasmine;
</cruisecontrol>

Notice I set the git path to "C:\Program Files (x86)\Git\cmd\git.cmd" and not "C:\Program Files (x86)\Git\bin\git.exe". I could never get bin\git.exe to work. I also found the read-only urls on a shared repository are easier to get working then the read/write urls, so use the read-only ones.

like image 81
Frank Schwieterman Avatar answered Sep 17 '22 20:09

Frank Schwieterman