In this blog post I will describe installing and configuring Jenkins Continuous integration server. This set-up was used for one of my current project to build Linux Application software.
Jenkins is an continuous integration server written Java . Jenkins monitor configuration management ( CVS,SVN,Perforce.. ) servers for changes , such as source code check-ins. Once it detects changes it will update the local working directory with the source from CM and performs series of build steps defined by the user on the source code. These build steps could be simple as invoking the shell script or build script such as make,ant .
Jenkins has many plug-ins available to extend its feature set and to integrate with other Software tools ( unit test, code coverage, code analysis ).
Jenkins is Java based software , hence it requires Java Runtime as prerequisite on a system.
Jenkins software is available as Debian package . To Install latest Jenkins software on Ubuntu execute following steps from command line
- 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 apt-get update
- sudo apt-get install openjdk-7-jdk
- sudo apt-get install jenkins
Once the installation completes make sure that Jenkins server up and running by opening web browser and pointing to http://localhost:8080 .
If Jenkins running you should see following page in the web browser . This completes the installation.
Configuring Jenkins with Perforce Configuration Management.
Jenkins natively support CVS and SVN CM. In my application I use Perforce for configuration management. Since Jenkins natively does not support Perforce CM I need to install Perforce plugin for Jenkins. Installing plugin is easy, Select “Jenkins->Manage Jenkins” option from the menu , select available tab to list the plugin and select and install perforce plugin. Following picture shows the “Manage Jenkins” page.
You can discover and install additional plug-in similar to perforce plugin from the page.
Configure source code build.
From the Jenkins main page select NewJob to create simple build step.
In the next page enter job name and select “Build free style software project” option . You can read about the various option by selecting help icon next to option.
Next page allows user to enter Configuration management specific details, in case Perforce CM, it user name,password and server details as shown below. These options differ based on the selected Configuration management .
Other configuration details such as source code depot ( Perforce specific ), workspace details , Poll interval ( how often Jenkins should poll CM for changes ), where to copy the build output are entered on the same page . Once the Configuration Management specific details are entered next step is provide instruction Jenkins to build software.
For this demo I have selected option to “Execute Shell” option to enter build command. With this option you can enter any Linux shell command . I will Apache ant to build my source code . Jenkins will execute these command once it check-out source code from the CM . I have entered following command to illustrate the build setup
echo “Build started…”
echo “Build Ended”
After saving this step Jenkins will start monitoring Configuration Management for changes, if changes detected it will pull changes to local workspace and execute the build scripts.
1. Jenkins website.