I recently setup jenkins for CI at RHC. We have quite a few number of projects going on, and continuos integration should definitely do us good.

I started out with an Ubuntu 14.04 LTS installation on one of our not-so-regularly-used PCs.

Installing Jenkins

This was pretty straight forward as I was on stock Ubuntu.

wget -q -O - https://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 jenkins

Android SDK

I downloaded the latest SDK for Linux tar from here. Extracted it and set the path (which was kind of useless as I'll explain later).

The next step was to update the SDK and it has a neat provision if I want to do it from the command line instead of launching android as widget. Simply run :

android list sdk --all

This will give you something like the following screenshot :

package list

Selectively install the packages that you want by mentioning the package numbers

android update sdk -u -a -t 1,2,3,4,20,21,22

This is pretty neat for command line fans, and was a discovery for me.

Plugins on Jenkins

It's pretty easy to install plugins on Jenkins. Point and shoot types. I installed the following plugins :

  • Git
  • Git Client
  • EnvInject (for injecting env variables just before a build)
  • Gradle

The gradle plugin is a bit nascent, and couldn't look for my ANDROID_HOME or ANDROID_SDK or pretty much anything ANDROID_*.

During the setup for the build, in a new job, I added sdk.dir=/home/user/android-sdk and ANDROID_HOME=/home/user/android-sdk

Apart from that, everything else is pretty standard. I added the GitHub URL to our app and made it fetch the code each time a build was initiated.


Plenty more things to be done. Among other things, need to get it integrated into Slack.