GitHub announced Jenkins -based continuous integration using Janky and Hubot with Campfire chat integration. Basically, it means from the Campfire chatroom we can setup a Jenkins job, setup service hooks on GitHub to trigger builds, get build info and so forth.
It sounded pretty compelling so I thought I would give it a try. The setup requires running Janky and Hubot web applications, and to wire them with Campfire chatroom and Jenkins server.
Here is how I went about setting it all up to trigger Jenkins job management from chat room.
I got a Jenkins instance provisioned with few mouse clicks at CloudBees DEV@cloud . You can run your own Jenkins server and also then do all the administration and management, but it's much easier and cheaper to have someone else do it for you.
CloudBees offers the DEV@cloud platform which includes Jenkins in the Cloud, and unlimited Gitand SVNrepositories with all PaaSbenefits (backups, high availability, secured, etc.). Checkout our new reduced pricing and choose the plan that fits your needs. You can start with a free subscription or choose the plan that fits your needs. Finally, if you have an Open Source project, you can join our FOSS program .
Not only are there obvious cost and PaaS-centricbenefits for developers, rather than hosting Jenkins on their own, but CloudBees DEV@cloudcomes ready to work with Jankyand already has GitHubintegration. Thus, it was an obvious choice for me.
Janky needs a Notification plugin to receive build related notifications. I installed the Notification plugin on the Jenkins Plugin management console.
Janky is a web application that talks to Jenkins, GitHub, Hubot and Campfire chat room. It's a Ruby/Sinatra application that serves the commands that are entered in the chat room and relayed via Hubot chat bot. It supports various commands meant to manage the builds of your GitHub repositories by communicating with Jenkins and GitHub. I followed Janky GitHub page to set it up. You can host it anywhere but make sure it accepts incoming connections. For our RUN@cloud platform, we are working on adding procfile support which will allow running Janky or Hubot or other non-Java languages based apps. Stay tuned, as it's being cooked!
Setting Janky was not that hard. The most critical part of this process was setting up about a dozen environment variables, most of these were credentials of GitHub, Hubot, Campfire chat and URL for Jenkins. Jenkins running on CloudBees DEV@cloud is protected, so I set JANKY_BUILDER_DEFAULT to the URL with basic auth. Please note the URL encoding applied to the basic auth username:password value.
Once Janky was setup, accessing it in browser shows the page below
Hubot is a chat bot developed by Github. It has built in support for Campfire chat. There are other adapters for various chat and IM systems, for example, IRC, GTalk etc. It's quite extensible, you can drop your own script to add additional commands that this bot can respond to. To add support for Jenkins commands, I needed to add janky.coffee script. I also had to set the environment variable to point to Janky endpoint URL with shared basic auth. This Janky endpoint listens to communication from Hubot.
Note about configuring Campfire chat: I had to set campfire env variable for Janky and Hubot with the chat room name and id, respectively.
While testing, I noticed Janky did not support talking to Jenkins over HTTPS. I fixed it in my Janky fork . My pull request has been accepted by the Janky project owner and it is now merged to the trunk. The next version of Janky gem should have this fix. In the meantime, you can either use my fork or Janky trunk which has these fixes merged.
Once I had Hubot and Janky configured, I logged into my Campfire chat room as a guest and noticed Hubot present in the chat room as Vivek P, since the Campfire account was set up with this name, and Hubot chat bot was set up with the same account. Real Vivek is me. Once in the chat room, I typed a command to set up Jenkins jobs for my GitHub repositories.
Almost instantly, there were jobs created on my Jenkins instance running over DEV@cloud. The job names were not what I expected, they look like some kind of unique ID, maybe a commit ID, but I don't think they are.
On checking the Jenkins job configuration, the notification plugin configuration had an entry with Janky endpoint where it can post build notifications.
The Job was configured with the default build script that goes in the Janky configuration config/jobs/default.xml.erb ,
To customize the build script, update default.xml.erb with your custom script and run hubot ci setup in the Campfire chatroom and the corresponding Jenkins job will be updated with the new script.
To sum it up, Janky is a great idea that opens up the social aspects of managing Jenkins jobs along with GitHub repos! DEV@cloud works seamlessly with Janky and provides many other benefits.
DEV@cloud is already GitHub friendly. Read how you can establish post-commit-hook to trigger build on commits to your GitHub repositories or how you can setup continuous deployment of your GitHub repo on RUN@cloud platform using DEV@cloud Jenkins in the cloud.
If you don't already have a CloudBees account, sign up now. You can subscribe to free DEV@cloud and RUN@cloud services to provision your instance of Jenkins, MySQL DB and deploy apps -- all automatically providing the benefits that come with the cloud and with the additional value-add of deep GitHub integration. And of course use Janky to manage them from a chat room!
-- Vivek Pandey
Elite Developer, CloudBees
Stay up to date
We'll never share your email address and you can opt out at any time, we promise.