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
- Which Hubot recognizes
- Who then builds a Jenkins job
- Which then executes some Ansible playbook
- 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:
- Create a reusable way to build any Jenkins job
- Since Hubot is a Node.js application, an event listener sounds logical
- 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 !!