Load Impact is here to enhance your load testing and help you find performance bottlenecks in your applications. But we also like to give you helpful engineering tips across a broad spectrum of topics. Check out this post for tips on boostrapping your Continuous Integration efforts.
Continuous Integration is hotter than ever, and for good reason. "BLAH BLAH, CI IS GREAT!" You know the drill.
Basically, you don’t need to change everything in your current development pipeline in one shot, you can take it in steps. A good first step would be to start using Jenkins.What will you need to get started? Firstly, you will need some hardware to run Jenkins on. Virtual hardware is as good as any, so boot up quickly on your favorite cloud hosting provider. It doesn’t have to be a monster machine, a CPU core or two with 2 GB of RAM will get you quite far for smaller projects.
If you intend to use Jenkins for larger projects and/or intend to have several builds running simultaneously, you will obviously want to crank up the hardware accordingly.
The amount of disk space you will need is very much dependant on the project you are working on. But here’s a few key things to remember:
By default, Jenkins will save all builds of your project, so make sure you have enough room for plenty of builds.
Then add a couple of GB for your favorite OS as well as Jenkins itself.
Finally, add a few more for good measure. It’s never fun to have builds fail because of a full disk. Bear in mind that some plug-ins can use a fair share of disk space as well.
The Jenkins software itself is a web based java application. Installing it is pretty easy thanks to all the different packages provided by Jenkins for almost all major operating systems. And if you’re already running an application server, a web application archive is provided as well.
Several package repositories are available too, making it a breeze to keep your installation up to date. If you, like me, are on a Debian based Linux flavour, installation is as follows:
Add the repository key:
<code>wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -</code>
Add the repository to your source list:
<code>/etc/apt/sources.list</code> deb http://pkg.jenkins-ci.org/debian binary/
Update your package list:
sudo apt-get update
And finally, install Jenkins.
sudo apt-get install jenkins
There are two different release tracks for Jenkins. The bleeding edge releases are called “Latest and Greatest” and the stable are called “Long term support”. Which you choose is up to you.
Another installation alternative could be to use a Turnkey image for Jenkins.
After installation is complete, you can access Jenkins in a web browser on port 8080 by default. No login is required and you should setup some security through the “Manage Jenkins” -> “Configure Global Security” menu.
If you, like me, like using Git, and in particular GitHub, you should install the GitHub plugin through the “Manage Plug-ins” menu. Click the “Available” tab and filter on “GitHub”. Install the GitHub plugin and make sure the server has “Git” installed as well.
If your repository is private, the Jenkins server will also need a SSH key to use when fetching your code from GitHub. Create one from command line or equivalent:
ssh-keygen -t rsa
Enter the private key as a new credential set in Jenkins under “Credentials” -> “Global credentials” -> “Add Credentials”. Switch “Kind” to “SSH username with private key” and paste your private key in the “Key” field.
Make sure your newly created public key is added to your repository as a deploy key on GitHub.
Now you are ready to create a job in Jenkins!:
Click “New Job” and select “Build a free-style software project” as well as giving it a name.
On the next page, select Git as your project’s source code management. Select the SSH key you entered previously as credentials and the URL to your GitHub project. If you want to build a branch other than master you can specify it here as well.
Save your settings and go ahead and build your project through Jenkins with the “Build now” menu. If everything was setup correctly you will now see a progress bar under the Jenkins menu while your project is building. Hopefully, you get a blue dot next to your project name, meaning your build was successful.
This is cool and all, but you’re not likely going to open up Jenkins each time you push new code. Instead, go over to GitHub again and do the following:
Open up the settings for your project.
Select “Service hooks” and then “Jenkins (GitHub)”.
Enter the URL of your Jenkins server followed by the path /github-webhook/.
Now for the fun part! Push some new code to your repo and watch Jenkins build your project without your intervention.
Congratulations, your first step in your continuous integration pipeline is now completed!
As a next step we suggest setting up email notifications for when builds are failing and explore some other plug-ins like the Load Impact Jenkins plug-in for automated load testing.