Hubot is your company’s robot. Install him in your company to dramatically improve and reduce employee efficiency.
In other words, hubot is a chat bot crafted by github team that can run custom written scritps. This allow us to automatize any kind of tasks like merging branches, deploying releases, do monitoring queries, inform (it listen on a port), etc. It has a lot of adapters (where it reads from and writes to), even shell, so we can enjoy its company almost everywhere.
It is written in coffescript and ran with nodejs.
In order to ease this process, we are going to setup and deploy it with docker. Following Dockerfile allowed me to run and test Hubot.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
Build an image with
docker build -t cname/hubot . or just use the commands for testing it. Nodejs setup instructions can be found on joyent’s nodejs repo
Let me introduce you to Marvin, my hubot instance, named like Hitchhicker’s guide to galaxy assistant robot.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Janky is a hithub project that implements CI on top Jenkins and Hubot. Chatops term is used to refer chat based deployments and monitoring.
One of the things I found interesting using hubot for is easy merging and deploy process. In this article I am just going to treat merging as an example, but concepts shown here could be easily used for integrating it with jenkins or any other tools.
We need to set some variables in order this to work. They are made available to hubot as environment variables, so you can set them on
env-vars.sh script mentioned in Dockerfile.
1 2 3 4 5
Enabling a plugin is as easy as adding it to
Once configured we can check if plugin was loaded sucessfuly and works properly.
1 2 3 4 5 6 7 8
It seems to work, and since it is using github merge API we are not messing any branch up.
I have chosen slack as default adapter since it is chat tool we are using at office. Hubots default one is campfire.
An organization, if you already don’t have one, needs to be created on slack. You can do it on sign up process. When this is done, just configure integrations and look for hubot there. You will get a token and even you can set a custom avatar for you shinny bot. Make this token availabe as environment varaible, and… that’s it.
Both processes are really straighforward.
Let’s see the results.
Enjoy your bot!