Where I work we use GitHub as our Git central repository, and we have Yoda, our Hubot, helping us on our day to day tasks. We had to setup a Continuous Integration server for our project and after looking at all the CI options out there, we had to decide between Travis-ci or Jenkins. Both are well-known continuous integration servers but they were not exactly what we needed at the moment. Travis is $150 per month and Jenkins has to be manually installed and configured, plus it has an awkward interface.
Travis could certainly be our solution in a future moment but, for now, we decided to try Jenkins out. As a solution for the issues raised, we decided to use Janky, “(…) a continuous integration server built on top of Jenkins, controlled by Hubot, and designed for GitHub”.
When I first read Janky’s readme, I thought it would be an easy setup… Well, I couldn’t be more wrong. It’s hard to know which values should be set for each of the required environment variables, and the gem is outdated forcing you to build it from git directly…
Anyway, one can always fork and submit pull requests, right? So, let’s focus on the setup process.
Janky recommends Jenkins version 1.427, but as I installed a newer version (1.498) you should be fine with newer versions. Installing Jenkins guide is easy to follow and will help you on installing a Jenkins server if you don’t have one yet.
Janky’s guide on the other hand will guide you to failure since the beginning as the [Gist][] you use to install is outdated and lacks the *JANKY_BRANCH* variable definition.. Apparently the gist has been updated, so you can almost run the commands as they say:
At this point, I suggest to not use the latest released gem version (0.9.13) – as its outdated – and bundle the gem directly from the repository by changing the following lines in the Gemfile.
to:
And now we can proceed with the installation guide:
All variables are defined with the following syntax:
Define janky’s URL on heroku with a trailing slash:
Our server has Jenkins’ Matrix-based security enabled, so only registered users can access Jenkins. In order to authorize Janky, you need to create an account for it and specify both the username and its api token that can be found on the user configuration page: http://jenkins.example.com/user/JENKINS_USER_NAME/configure on the URL.
Define the configuration dir (default):
Hubot’s user and password are the same passwords you will use when configuring Janky’s hubot script. Create your own secure user/password here.
You have to create a github account (or use your own) to allow janky to connect to github and set up service hooks for you.
There are two variables that apparently should be configured with the same value, and the token value is obtained by using the one that comes in the following curl command response:
You should also specifiy the default chat room, but I don’t know whether this is the room name or number on campfire. It should not be a problem as long as you specify the room for each project.
Now you can run the database migration.
Configuring hubot is pretty easy, all you have to do is enable its script on hubot-scripts.json:
and define an environment variable on hubot’s server (not janky’s). Don’t forget to append _hubot/ to the URL:
After all heroku commands you might need to specify the app on which you want to run the command using the argument −−app.