The Role of Bots in DevOps
DevOps has evolved from its infancy into a mainstream focus area for a majority of CIOs. DevOps has become a main focus and has been shaping the world of software and infrastructure engineering and operations for the last few years.
Some of the key DevOps trends include:
- DevOps assembly lines automation.
- Smart, actionable alerts from monitoring tools.
- Monitor and orchestration infrastructure.
With the increase of DevOps adoption, organizations today face many challenges in the end-to-end service delivery life cycle.
- For applications with complex environment configurations, creating, setting up and deploying a new environment is costly, time-consuming and prone to errors.
- Due to manual interventions, moving/promoting code across environments involves risks and may give rise to outages.
- Development teams are looking to maximize change by writing new code or enhancing existing code, while operations teams are looking to minimize change to keep up with key performance indicators (KPIs) and service level agreements (SLAs). These goals are opposing in nature and create a culture of blame between dev and ops teams.
- Organizations are unable to keep dev, test and production in synchronization due to process and tool gaps. A manual process cannot bridge this gap in consistency; thus, outages in production are common.
Various collaboration mechanisms let teams work and learn together to produce better results. The figure below depicts the end-to-end life cycle of DevOps. Collaboration across the phases is essential to the success of your enterprise DevOps transformation.
What are ChatOps and Bots?
ChatOps is a term coined by GitHub to describe “putting tools in the middle of a conversation.” In a typical CI/CD pipeline, there are multiple tools that you interact with that have varied functionalities, such as source code management (SCM), defect management, continuous integration, continuous deployment and others. These are all discrete tools, but there is nothing that bridges them together. This is where ChatOps comes into play.
A bot is a bridge between the collaboration tool and the DevOps tools. The bot receives a request from the user in the form of a chat command through a collaboration tool, analyzes the request and executes a set of commands on the target DevOps tool.
The main components of ChatOps and bots are:
Chat app/collaboration tool: This is the front-end chat system that connects the various stakeholders and enables them to interact between themselves and the systems around them.
The bot: This is the core of ChatOps. A bot is the glue between your collaboration tool and your systems. It facilitates a two-way communication channel where you can fetch relevant information from the systems and act on the information received. A bot fits in between your collaboration tool and the DevOps tools, e.g. Hubot, Lita, ErrBot or AWS Lex.
Target platform/infrastructure: Integration with the target platforms/DevOps tools is a key ingredient to a successful implementation of bots. These are the target tools and platforms on which the bot will execute the required commands. The tools integration allows your bot to communicate with tools and execute actions such as build, deploy, test, provision and scale infrastructure directly from the chat window.
Where Bots Fit in the DevOps Pipeline
Bots can prove to be an accelerator in various stages of the CI/CD pipeline. Below are the details of the integration with various DevOps tools in each phase of the life cycle:
- Proactive planning – JIRA
- Requirements management – JIRA
- Continuous integration – Jenkins
- Continuous deployment – Ansible, Chef
- Continuous monitoring – Nagios, Grafana, Splunk
- Continuous feedback – JIRA
A chatbot plays a major role in bringing the different teams together into a single, persistent chat room to triage and resolve the issue at hand. In addition to just troubleshooting and triaging issues, bots can be used for various other business-as-usual jobs including:
- Cleaning up servers.
- Kicking off build and deployment jobs.
- Rotating server logs.
- On-boarding application on the monitoring tools.
- Collecting metrics from tools such as Nagios or AppDynamics.
Bot Technical Blueprint
To achieve the aforesaid targets, we need to have a supportive bot platform in place. How closely the tools integrate with the bot ensures the quality of the implementation and opens new opportunities of automation.
As the diagram depicts, the chatbot is hosted on a chat tool such as Slack. This can be on the cloud platform or an existing chat/communicator application. The bot is integrated with a key-value pair reference database, which is fed with the responses depending upon the activities or capabilities that have been fed to it. The key could be the name of the application to retrieve data from or any unique ID that would reduce the number of reads. A lookup of the defined key corresponding to the secondary key is performed on the response database and a response is sent back to the chatbot. Depending upon the number of outputs, the queries can be defined and stored in the response database.
DevOps Bots: Use Cases
Below are some examples of use cases for bots. This includes the complete life cycle of DevOps:
Create new user stories in sprint planning tools and assign sprints to teams. Update sprints and product backlogs.
Build and Continuous Integration
Execute build jobs and report back statistics of the build job. Perform daily/nightly builds and report on the status of the build to the relevant teams.
Run deployment jobs and perform deployments across environments. Roll back deployments in case of failures, status checks, perform post-deployment actions such as JVM restarts.
Infrastructure Provisioning and Configuration Management
Kick off Chef jobs to provision infrastructure or provision application environments. Enable monitoring and restarting services and servers.
Provide application statistics or performing daily data lookups and grabbing metrics.
Monitor application health and perform analytics.
Key Measurement Metrics
To achieve optimization and enhance performance of the continuous delivery process, metric measurement is the key. These indicators will help in taking certain corrective and preventive actions based on the results. Below are some of the key metrics indicators that can be measured.
Indicates the reduction of human/manual efforts for tasks such as triggering a build or deployment or collecting metrics from monitoring tools.
Human Error Reduction Rate
Reduction in the effort required due to rework caused by human errors.
Reduce Issue Triaging time
Indicates the time taken to resolve issues where multiple parties are involved and triaging of problems is required.
DevOps bots can significantly improve team efficiency, as well as a team’s ability to respond to emergencies. They save time and money, are fun to build and use and can have a positive impact on team morale, as well as increases the overall productivity of teams. This applies to both the engineering and operations teams. Enterprises embracing digitization are looking for partners with an engineering mindset who know how to bring in collaborative agile teams with the very latest knowledge of open source platforms and DevOps toolchains.