This article describes how to use the Jenkins continuous integration build server.

1. Using the Jenkins build server

Continuous integration is a process in which all development work is integrated as early as possible. The resulting artifacts are automatically created and tested. This process should identify errors as very early in the process.

Jenkins is one open source tool to perform continuous integration and build automation. The basic functionality of Jenkins is to execute a predefined list of steps. The trigger for this execution can be time or event based. For example, every 20 minutes or after a new commit in a Git repository.

The list of steps can, for example, include:

  • perform a software build with Apache Maven or Gradle

  • Run a shell script

  • Archive the build result

  • Afterwards start the integration tests

Jenkins also monitors the execution of the steps and allows to stop the process if one of the steps fails. Jenkins can also send out notification about the build success or failure.

Jenkins can be extended by additional plug-ins, e.g., for building and testing Android applications or to support the Git version control system.

2. Installation of Jenkins

Jenkins can be started via the command line or can run in a web application server. Under Linux you can also install Jenkins as a system service.

For most platforms you have native packages, see the Jenkins Homepage.

If you installed Jenkins locally, you find it running under the following URL: http://localhost:8080/

2.1. Installing of the Jenkins server on Ubuntu

Jenkins provides Debian/Ubuntu packages which install Jenkins and register Jenkins as start service. See the Install Jenkins on Ubuntu description The Linux installation creates a /etc/init.d/jenkins script which starts Jenkins automatically at boot time.

Jenkins stores all the settings, logs and build artifacts in its home directory. The default installation directory is /var/lib/jenkins under Ubuntu.

2.2. Using the .WAR file of Jenkins

Download the jenkins.war file from Jenkins Homepage. From this file you can start Jenkins directly via the command line with java -jar jenkins*.war.

If you start it locally, you find it running under the following URL: <ulink url="http://localhost:8080/">http://localhost:8080/</ulink>;

To run it in your Tomcat server, put the .WAR file into the webapps directory. If you start Tomcat, your Jenkins installation will be available under <ulink url="http://localhost:8080/jenkins"> http://localhost:8080/jenkins</ulink>;

If the jenkins.war is deployed in your webapps directory, but cannot be started and the tomcat manager says <quote>FAIL - Application at context path /jenkins could not be started </quote> , you may need to grant the permissons for JENKINS_HOME .

<programlisting>cd /usr/share/tomcat7 sudo mkdir .jenkins sudo chown tomcat7:nogroup .jenkins </programlisting> This makes the .jenkins folder writable and Jenkins can use it.