In this tutorial series we will explore a rarely discussed (but highly valuable) process of developing software that is disappointingly absent in the iOS and mobile world: Continuous Integration.
Where We Left Off
In part 1, we discussed the concept of Continuous Integration and how it can assist us in developing software faster. In part 2, we demonstrated how to install “Apache Tomcat”, which is the web server that will host our CI software.
Introducing Hudson
Hudson is an open-source Continuous Integration server written in Java. It is one of the more popular CI servers used alongside Jenkins and Atlassian’s Bamboo. We’re using Hudson because:
- It’s easy to install and configure.
- It’s easy to use.
- Robust plugin support is available.
- It’s free!
Hudson is currently maintained by Oracle, who has stated that they intend to continue support and development for Hudson with the community.
What Does Hudson Do?
Hudson plays an important part of the CI process. It monitors the code repository and continually checks for updates. Once it determines there has been an update, it will do an update/pull and start the build. It is important to note that Hudson is not responsible for the build action itself. It can only call a script (which we will write) that will do the building and archiving. Once the script has started, Hudson will monitor the script. If it fails, it will report a broken build.
Step 1: Download And Install Hudson
Setting up Hudson is very easy. First, navigate to Hudson’s website at http://hudson-ci.org/, and then click the download link for the latest production version (2.1.2 at the time of writing) this will download a *.war file.
Once the download is finished, rename the file to “hudson.war” and put the file into Tomcat’s “webapps” folder:
mv hudson.war /usr/local/tomcat/webapps/
If the server is currently running, restart it by running the shutdown script, wait a few seconds, and then run the startup script again. When that’s done, open a browser and navigate to:
Hudson will tell you that it’s setting up. Once it’s done, you’ll see the main screen of Hudson.
Step 2: Create Your Project
Now that Hudson is up and running we need to set up a project or “job”. This job will relate to a project that we want to add to our CI.
This ‘job’ will be responsible for monitoring our repository, staying up to date and building the project. Click on new job and enter your project/app name as the job name. Select “Build a free-style software project” as the type of job. This will give us the flexibility to customize the job to our needs. Click “ok” when you’re done.
Next, we need to set up the project settings. The important sections on this page are “Source
Code Management”, “Build Triggers”, and “Build”.
Step 3: Set Up Source Code Management
In “Source Code Management”, we choose what type of repository we are using and se the URL. In this example, I’m using GIT, but Subversion follows the same process.