onsdag 20 mars 2013

Jenkins & GITourous


The subject of this piece is how to configure jenkins&gitorous

I am using this on a Amazon EC2 with a Bitnami-stack
Either you go for 1 or for 2.

1:  You need to set up your free AWS account at Amazon.
http://aws.amazon.com/

http://aws.amazon.com/ec2/

In the Management console: The AWS Management Console
I am running my instance ( Ubuntu + Bitnami ) in Ireland.

[ more to come on this subject ] 

So my distribution of choice is Ubuntu ( as a server, as a client ).
But in this example, the server is in focus - no focus on the ubuntu-client.

2: or you don't use Amazon EC2, just install jenkins + gitorous on your Linux-dist of choice ( se 1,2 and 3 in the Prereqs ).

Prereqs :

The 'apps' that I will be dealing with regards to this mission is the following:
We have already set up these projects, not the subject of this piece.
  1. Jenkins , a CI-server 
    1. With internat git-client, version 1.7.11.3
  2. Gitorous, A Version Control system
  3. Installed Maven 3, now - I am just using it as a build-tool 
AND -> My Projekt in Gitorous is a Java/Maven-project: 

I have to ensure that the following is working:
I am able to check-out ( pull ) my project out on my Ubuntu-client from the CLI, I am able to do so as well from Netbeans 7.3 ( pointing to my private-key in my .ssh-directory).
And it is working, I am able to check-out my project!

Problem:

Jenkins should retrieve the source code from my gitorous-project and automatically build it ( well, that is what Jenkins does, doh ) , the hurdle is the ssh 'public key authentication'.

The solution is not in a box, I have to fix some things first.
Jenkins is a software with many plugins:
I will go for the plugin ' publish-over-ssh '

Login to Jenkins:
  1. Go to 'Manage Jenkins'
    1. Choose 'Manage Plugin'
      1. Choose the tab 'Available'
      2. Check 'Publish Over SSH Plugin' ( ver 1.10 ) 
      3. press the button ' ~ without restart'
      4. See if you got the 'blue ball' and 'Success' label .
        1. if so -> you are on top of the world
        2. " Go back to the top page
          (you can start using the installed plugins right away) "
      5.  Click 'Go back to the top page' ....
  2.  You are at 'Manage Jenkins'
    1. Choose 'Configure System'
    2. Top of the page, you can find the 'home directory' ( using bitnami )
      1. JENKINS_HOME = /opt/bitnami/jenkins/apps/jenkins/jenkins_home
    3. Follow the Guide -> ' publish-over-ssh ' -> From configure

Go to 'your server' :
  1. Create a .ssh-directory in JENKINS_HOME if it does not exist
  2. on my server -> /opt/bitnami/jenkins/apps/jenkins/jenkins_home/.ssh 
  3.  SSH key-pair:
    1. >ssh-keygen -f jenkins_id_rsa -C '-some-mailadress-' -N '' -t rsa -q

or use some filename instead of 'jenkins_id_rsa' .






On my server ( pointing to the private key )
Path to key = /opt/bitnami/jenkins/apps/jenkins/jenkins_home/.ssh/jenkins_id_rsa

Key: paste in the private key ( see Guide above )