Setup ssh key pair for jenkins under windows

It is always tricky to setup jenkins properly when running under Windows. There are a few things you need to take care of. In this post I will assume you are using the bash shell delivered together with git.

  • Create a new user account for jenkins
  • Set a password for this user account
  • Add the HOME environment variable for Jenkins
  • Start a bask shell under the new user.
  • Generate the ssh key
  • Add you public key to your target server
  • Make a new ssh connection to your server to add it to the known hosts

ssh uses the HOME environment variable to locate the .ssh folder that contains the ssh keys. If this folder is not present it will default to C: which is not a good place to store your keys. So it is very important to add  this HOME variable for a stable functioning of jenkins. If you can not actually log in using the jenkins account you can still set the variable using the registry. The Windows runas command will be used to allow us to add the environment to the user jenkins even when we are not logged in as such.

runas /user:jenkins reg add KEY  /v HOME /t REG_SZ /d "C:\Documents and Settings\jenkins"

Next we start a bash shell to check the HOME var and create the ssh key.

runas /user:jenkins "C:\Program Files\Git\Bin\bash.exe"

This will open a new bash shell that is logged in as jenkins. In this bash shell you can now check the HOME variable, generate your ssh key and add the server to you known_hosts

$ echo $HOME
/c/Documents and Settings/jenkins
$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Documents and Settings/jenkins/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Documents and Settings/jenkins/.ssh/id_rsa.
Your public key has been saved in /c/Documents and Settings/jenkins/.ssh/
$ ssh -p 29418 gerrit ls-projects

Now the ssh has been setup properly you need to change the service user from the Local System account to log in as the user Jenkins.
Lastly, restart the service and Jenkins should be using the correct ssh credentials.

How to edit the project.config for all projects in Gerrit

While I was evaluating Gerrit 2.6 I ended up installing the building the latest snapshot version (2.7RC) myself. All was fine until I was about to setup Jenkins to verify my commits. I was surprised to find the label “Verified” missing from the reviews. After some googling I found that in version 2.7 this has been removed and needed to be added manually in the project.config. After searching my drives I could not find this project.config only to realize that this is a file in the meta config. And this below is how you edit it:

mkdir tmp
cd tmp
git init
git remote add origin ssh://
git fetch origin refs/meta/config:refs/remotes/origin/meta/config
git checkout meta/config

Now you should have the project.config in you temp folder. Add the label as below:

[label "Verified"]
       function = MaxWithBlock
       value = -1 Fails
       value =  0 No score
       value = +1 Verified

Next you need to commit and push back to Gerrit. Ofcourse make sure you have the appropriate rights.

git commit -a
git push origin meta/config:meta/config

Cross flashing firmware for Supermicro AOC-S2308L-8i

I was trying to install Openindiana using the Supermico AOC S2308L-L8i HBA but I was unable to get Openindiana to recognize the card.

At this point I decided to cross flash the card to the LSI SAS 9207-8i firmware that uses the same controller.

As a back up I downloaded the original Supermicro firware from there ftp server.

In the original firmware there is a nice script for UEFI boot that shows you how to flash the card.
This is the original script:

echo -off 
sas2flash.efi -o -e 7
sas2flash.efi -f <del datetime="2013-04-16T15:43:11+00:00">2308IT14.ROM</del>9207-8.BIN
sas2flash.efi -b mptsas2.rom
sas2flash.efi -o -sasaddhi 5003048

To flash using the LSI firmware you just need to replace the 2308IT14.ROM with the 9207-8.BIN. Copy the script and the 9207-8.ROM and mptsas2.bin into the same folder and you are good to go.