Reusable Hubot Event Listener to Build Jenkins Jobs

Jenkins (thank you CloudBees !!) is my chosen automation platform, often triggering an Ansible playbook (thank you Michael !!) to automate some mundane task ..  I also use HipChat and have implemented a Hubot (thank you GitHub !!) chatbot .. Wouldn’t it be nice to integrate it all ?? For example, in HipChat:

@hal restart tomcat in dev
  1. Which Hubot recognizes
  2. Who then builds a Jenkins job
  3. Which then executes some Ansible playbook
  4. Which then restarts Tomcat in the development environment

Actually, it’s not that difficult .. For this post, I won’t go into the details on how to setup Hubot (this might help) or how to restart the Tomcat service (this might help) .. What I am most interested in is how to:

  1. Create a reusable way to build any Jenkins job
    • Since Hubot is a Node.js application, an event listener sounds logical
  2. Invoke this reusable way
    • i.e. event trigger

Here is an example of a Hubot event listener that can build a Jenkins job with or without parameters ..

Here is an example of a Hubot command that can trigger the previously defined event listener ..

I hope this helps !!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s