Meet Jenkins

Hey folks,

Let's talk about Jenkins today, an extendable open source continuous integration server.

You can use CI servers to run all of your tests every time you push/commit something to your SCM like git or svn.

That's amazing because you do not need to run your entire suite on your machine and lose time instead of coding.

I'm using a Linode 1024 for Jenkins but you can use what you want.

I recommend you to use at least 1024MB of RAM if you have integration tests.

Installation

You don't need too much to get a Jenkins running.

apt-get install jenkins

Now just access your server IP on port 8080.

If you aren't using Ubuntu, you can get the native package on Jenkins website.

Authentication

Jenkins do not have authentication enabled by default, but you can configure that!

Jenkin's own user database

Open Jenkins and access "Manage Jenkins" and then "Manage Users".

Create all users you need and back to "Manage Jenkins" and click "Configure System".

Now you need to check the "Enable security" and select "Jenkin's own user database" on "Security Realm".

Check "Matrix-based security" and give permissions here.

If you want a read-only authorization, you should check overall read and job read.

Don't forget to give administer permission to yourself or you will need to recover the access using console.

LDAP

If you use LDAP, you can get some help here.

Git

If you are using git, you need to install on your server like this:

apt-get install git-core

Jenkins does not support git by default but you can use Git Plugin.

Just access "Manage Jenkins" and "Manage Plugins" to install.

Projects

You need to create your project now, right?

Access "New Job" and fill the name and check the "Build a free-style software project".

SCM

On the next screen, you will choose your SCM and fill the URL of repository.

I'm using Codeplane which haven't push notification yet.

The alternative is "Poll SCM" every 5 minutes using this schedule:

5 * * * *

Build steps

My current build step uses bash:

#!/bin/env bash -e
cp config/database.sample.yml config/database.yml
bundle install --quiet
rake db:migrate db:test:prepare
rake

This build step is used for my current project.

You can configure the build step to what you need.

E-mail notification

You can send an e-mail notification for every unstable build.

Check "E-mail notification" and fill the e-mails what you want to send the notification.

Done!

Save your project and start to slap who broke the build.

You can do something more friendly than slap, like this video of retaliation.

blog comments powered by Disqus