1 of 13

Continuous integration

  • Continuous Integration (CI) is a process in which whenever a developer performs code check-in shared repository, the whole project is automatically build and tested, in order to find Integration issues.

  • CI reveals integration issues at a very early stage.

2 of 13

How CI works

Local Repository

Remote Repo

CI Server

Compile

Unit Test cases

Regression Test cases

Publish reports

3 of 13

Benefits of CI

  1. Continuously integrates the whole project, thereby eliminating the Integration phase.
  2. Catches Issues at very early stage.
  3. Reduces time for de-bugging, as issues are caught at each integration.

  • Help to deliver the product more rapidly.

4 of 13

Famous tools for CI

  • The famous tools for CI are :
  • Jenkins
  • Hudson
  • Team city
  • Team foundation server

In above Jenkins and Hudson are free CI tools.

5 of 13

Jenkins

  • Jenkins is a open-source Continuous tool/server, which is used to automatically build the whole project whenever needed
  • Jenkins is originally created as Hudson, but after dispute with Oracle, this project is separated by open source community as “Jenkins”.

6 of 13

Installing and running Jenkins

Use following steps to install and run Jenkins on local environment :

  1. Go to http://jenkins-ci.org/ and download Jenkins server in .war format.
  2. Open CMD and run following command to start the server :

java –jar jenkins.war

3. By default Jenkins runs on 8080 port, so open a browser and hit URL as http://localhost:8080

7 of 13

Opening Jenkins in Browser

  • As Jenkins also comes as Java Web Archive, it can be run as a Web application, by running the Jenkins Servlet container.
  • Jenkins uses all other tools of the same server and make them to work together to automate the build process.
  • But before any build process, we need to configure the Jenkins!!!!

8 of 13

Configuring Jenkins Plug-ins

  • More than 600 plug-ins are available to customize Jenkins as per project requirements.
  • To Manage Jenkins plug-ins use following steps:
  • Open Jenkins in browser
  • Click on “Manage Jenkins”
  • Click on “Manage Plug-ins”.

  1. Go to “Available Plug-ins” and choose the plug-in you need.!!!

9 of 13

Jenkins Configuration Wizard

In order to connect Jenkins with other tools (i.e java, maven etc.) first we need to configure the Jenkins.

  • Use following steps to configure Jenkins:
  • Open Jenkins in any browser.
  • Click on “Manage Jenkins”
  • Click on “Configure System”
  • Now configure following :
  • Java :

a) Set the path of “Java_Home” variable as of System variable. (e.g. C:\Program Files\Java\jdk1.6.0_17)

10 of 13

Jenkins Configuration Wizard - continued

  • Git :

a) Set the path of Git installation directory (e.g. C:\Program Files\Git\bin\git.exe)

  • Maven:

a) Set the path of Maven installation directory as of Maven_Home variable ( e.g. E:\maven2\apache-maven-3.0.5-bin\apache-maven-3.0.5)

5. Now “save” the above settings.

11 of 13

Jenkins Build Jobs

  • Build Job is nothing but a particular step in build process.
  • A single project can have a number of build jobs.
  • For example : compiling and running the source code a single build job and running a integration test is another build job.

12 of 13

Creating Build Jobs

  • In order to create a build job use following steps:

1. Open Jenkins

2. Click on “new Job”

3. Give a Job name and select “build a free style software product” and click on “OK”

4. A Project configuration screen will appear.

5. In Source code management select “Git” (because our source code is in “Git-hub”).

6. Now give the git hub – source code URL.

13 of 13

Creating Build Jobs - continued

7. In Build trigger section we need to tell Jenkins that at what time we want to trigger the building process.

> Select Pol SCM

> Enter @hourly in Schedule section which means we want to trigger the build process at every hour.

8. In Build Section we have to specify in which way we want to do the build process, since we want to use Maven, therefore select “Invoke top level Maven targets “

9. In Maven version give the version of Maven you are using.

10. Set the Goal section of Maven as

“clean package”