Search
Tweets
Recent Changes
Friday
Feb102012

OSS Work for February 10th

A few new things today:

Yay!

Wednesday
Feb082012

OSS Work Today

It was a productive day for me. It would be worthwhile for me to blabber about the things I’m doing!

Tomorrow I should have a few more. How productive of me!

Thursday
Oct132011

Interesting Bits for October 13th, 2011

Trying out a new idea: Shlepping up juicy bits from the hundreds and hundreds of RSS-sourced items I read every day.

We'll see if I keep this up.

Soccer Stuff

Wenger claiming Sagna's absence is ok whilst Fabianski whines about first-team play don't help my confidence in my gunners right now..

Saturday
Sep032011

Quote of the Day

The reduction to the essential has never lead to any catastrophes.

Deiter Rams

Thursday
Sep012011

Jenkins and GitHub: Multiple Private Projects

I’m working with GitHub private repositories for the first time. I’m also working with using Jenkins with GitHub for the first time. As such, I’m learning a few things.

The first major hurdle I ran into was setting up checkout of multiple repositories.

Deploy Keys

Deploy keys are one-off keys that you add to a single repository that allow it to be checked out. For public repositories this isn’t necessary (although it does still exist) because anyone can access your repository read-only.

For private repositories you must use deploy keys unless you want full read-write access exposed to Jenkins.

The wrinkle is: How do you use a key for each checkout?

How To Do It

GitHub provides some help with their Multiple SSH Keys document. The only thing we need is a gentle push to make this work with Jenkins’ Git Plugin.

When you generate your keys, name them according to the project they will be used with.

ssh-keygen -t rsa -f ~/.ssh/id_rsa.projectA -C "Key for Project A"

After generating your key, add the public key into GitHub’s deploy keys.

In your Jenkins user’s $HOME, add a .ssh/config file, just like the GitHub instructions above. Then define a Host entry for each repository:

Host github-projectA
    Hostname github.com
    User git
    IdentityFile ~/.ssh/id_rsa.projectA

For each of your projects, copy that block but change projectA to projectB in both the Host and IdentityFile lines. The Host line is defining a special hostname (which really points to github.com via the Hostname line). This differentiation tells ssh to use a different key.

The final step is to modify the repository that we’ll be checking out:

git@github-projectA:iinteractive/prg-labor.git

The github-projectA ties us back to our Host setting above.

Fin!

With these instructions you should be able to safely add one-off deploy keys to enable your Jenkin’s server to checkout all your projects. Go forth and integrate. Continuously!

Update Corrected -C option to ssh-keygen