Setting Up Continuous Integration

From sselab

(Difference between revisions)
Jump to: navigation, search
(Installation)
Line 3: Line 3:
* [http://martinfowler.com/articles/continuousIntegration.html Martin Fowler's article about Continuous Integration]
* [http://martinfowler.com/articles/continuousIntegration.html Martin Fowler's article about Continuous Integration]
-
== Manuall Installation ==
+
== Manual Installation ==
=== Getting a server for your Continuous Integration ===
=== Getting a server for your Continuous Integration ===
-
** Inside the RWTH you can order a virtual Maschine from the NOC [http://www.rz.rwth-aachen.de/ca/k/sec/lang/de/ Hosting of institute servers] and [https://www.campus.rwth-aachen.de/rzshop/bestellen/index.php RZ-Shop]
+
** Inside the RWTH you can order a virtual machine from the NOC [http://www.rz.rwth-aachen.de/ca/k/sec/lang/de/ Hosting of institute servers] and [https://www.campus.rwth-aachen.de/rzshop/bestellen/index.php RZ-Shop]
-
** Outside you could use common cloud providers that offer virtual maschines
+
** Outside you could use common cloud providers that offer virtual machines
=== Continuous Integration with Jenkins for Ubuntu servers ===
=== Continuous Integration with Jenkins for Ubuntu servers ===
Line 21: Line 21:
  sudo aptitude install jenkins
  sudo aptitude install jenkins
-
* more intormation can be found here [https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+Ubuntu]
+
* more information can be found here [https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+Ubuntu]
-
* general information and different installation of jenkins [https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins]
+
* general information and different installation of Jenkins [https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins]
 +
 
 +
Now you can access Jenkins via the Homepage (e.g. http://localhost:8080/jenkins) configure general settings and create your first Job. In Jenkins a Job is a Softwareproject that should be build.
==== Configuration====
==== Configuration====
-
*run the war Archive[https://wiki.jenkins-ci.org/display/JENKINS/Starting+and+Accessing+Jenkins] or deploy it on your Glassfish or Tomcat server.
+
 
-
**Now you can access Jenkins via the Homepage (e.g. http://localhost:8080/jenkins) configure generall settings and create your first Job. In Jenkins a Job is a Softwareproject that should be build.
+
*Choose for your Job a Name and the "Free-Style" Type of the Job. After that step a new Job is created and you can configure this Job.
-
**Choose for your Job a Name and the "Free-Style" Type of the Job. After that step a new Job is created and you can configure this Job.
+
**For "Source-Code-Management" choose Subversion. The Repository URL is something like: sselab.de/lab2/private/svn/<SSELAB-Prjoject-Name>/trunk/.
**For "Source-Code-Management" choose Subversion. The Repository URL is something like: sselab.de/lab2/private/svn/<SSELAB-Prjoject-Name>/trunk/.
-
**In the next two steps you have to configure when and how the Project should be compiled. For CI you should select "Poll SCM". If you want to compile your Sourcecode with Apache Ant, you can define the Ant targets and files under Build-Invoke Ant.
+
**In the next two steps you have to configure when and how the project should be compiled. For CI you should select "Poll SCM". If you want to compile your source code with Apache Ant, you can define the Ant targets and files under Build-Invoke Ant.
**You can define some additional Post-build Actions like: run JUnit, measure Code Quality with Sonar, write some Emails.
**You can define some additional Post-build Actions like: run JUnit, measure Code Quality with Sonar, write some Emails.
-
*Codemesurement with Sonar in Jenkins (general installation [http://docs.codehaus.org/display/SONAR/Install+Sonar] )
+
*Code measurement with Sonar in Jenkins (general installation [http://docs.codehaus.org/display/SONAR/Install+Sonar] )
**To measure your code in Jenkins with Sonar you have to install Sonar [http://www.sonarsource.org/].
**To measure your code in Jenkins with Sonar you have to install Sonar [http://www.sonarsource.org/].
**After downloading your copy of Sonar, you can configure the basic sonar settings like the used DB-Server. Since the default settings meet our actual needs (and no external Database has to be configured) we can directly compile the war-Archive.
**After downloading your copy of Sonar, you can configure the basic sonar settings like the used DB-Server. Since the default settings meet our actual needs (and no external Database has to be configured) we can directly compile the war-Archive.
**Do so with executing the build-war file in /sonar-2.1.13.1/war/ of the downloaded ZIP-Archive. As the next step you have to deploy that WAR-File on your JEE-Server. (Be advised that Glassfish and JBoss is not officially supported!)[http://docs.codehaus.org/display/SONAR/Install+Sonar#InstallSonar-SupportedPlatforms]
**Do so with executing the build-war file in /sonar-2.1.13.1/war/ of the downloaded ZIP-Archive. As the next step you have to deploy that WAR-File on your JEE-Server. (Be advised that Glassfish and JBoss is not officially supported!)[http://docs.codehaus.org/display/SONAR/Install+Sonar#InstallSonar-SupportedPlatforms]
**Now you can browse to your local Sonar installation (on e.g. http://localhost:8080/sonar).
**Now you can browse to your local Sonar installation (on e.g. http://localhost:8080/sonar).
-
**In the next step you have to install the Sonar Plugin in your Jenkins, configure the Plugin in the global Jenkins settings (http://localhost:8080/jenkins/configure/ ) and activate that plugin for your job in Jenkins.
+
**In the next step you have to install the Sonar plug-in in your Jenkins, configure the plug-in in the global Jenkins settings (http://localhost:8080/jenkins/configure/ ) and activate that plug-in for your job in Jenkins.
-
**it might be neccessary for sonar to increase the available heapspace (see next section Improvements)
+
**it might be necessary for sonar to increase the available heapspace (see next section Improvements)
*Improvements
*Improvements

Revision as of 14:07, 15 March 2012

Contents

About Continuous Integration

Manual Installation

Getting a server for your Continuous Integration

    • Inside the RWTH you can order a virtual machine from the NOC Hosting of institute servers and RZ-Shop
    • Outside you could use common cloud providers that offer virtual machines

Continuous Integration with Jenkins for Ubuntu servers

At this point we assume that you have access to a server for your continuous integration. The following software component should be installed on this server:

  • You need to have a ssh server installed and configured. open-ssh-server are suggested.
  • You need to have a JDK and JRE installed. openjdk-6-jre and openjdk-6-jdk are suggested.

Installation

wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo aptitude update
sudo aptitude install jenkins
  • more information can be found here [1]
  • general information and different installation of Jenkins [2]

Now you can access Jenkins via the Homepage (e.g. http://localhost:8080/jenkins) configure general settings and create your first Job. In Jenkins a Job is a Softwareproject that should be build.

Configuration

  • Choose for your Job a Name and the "Free-Style" Type of the Job. After that step a new Job is created and you can configure this Job.
    • For "Source-Code-Management" choose Subversion. The Repository URL is something like: sselab.de/lab2/private/svn/<SSELAB-Prjoject-Name>/trunk/.
    • In the next two steps you have to configure when and how the project should be compiled. For CI you should select "Poll SCM". If you want to compile your source code with Apache Ant, you can define the Ant targets and files under Build-Invoke Ant.
    • You can define some additional Post-build Actions like: run JUnit, measure Code Quality with Sonar, write some Emails.
  • Code measurement with Sonar in Jenkins (general installation [3] )
    • To measure your code in Jenkins with Sonar you have to install Sonar [4].
    • After downloading your copy of Sonar, you can configure the basic sonar settings like the used DB-Server. Since the default settings meet our actual needs (and no external Database has to be configured) we can directly compile the war-Archive.
    • Do so with executing the build-war file in /sonar-2.1.13.1/war/ of the downloaded ZIP-Archive. As the next step you have to deploy that WAR-File on your JEE-Server. (Be advised that Glassfish and JBoss is not officially supported!)[5]
    • Now you can browse to your local Sonar installation (on e.g. http://localhost:8080/sonar).
    • In the next step you have to install the Sonar plug-in in your Jenkins, configure the plug-in in the global Jenkins settings (http://localhost:8080/jenkins/configure/ ) and activate that plug-in for your job in Jenkins.
    • it might be necessary for sonar to increase the available heapspace (see next section Improvements)
  • Improvements
    • increase available Heapspace for Jenkins and Sonar in Glassfish
    • configure Sonar with an external Database like Postgres or MySQL to gain more speed during Code measurement
    • secure Jenkins [6] and Sonar with username/password access
    • all processes started during a build of Jenkins are killed by Jenkins after the build, so be careful with starting anything that should run even after the build finishes [7]

Automated Usage

  • Coming soon as a Sselab service