Skip to main content
Toggle menu

Search the website

The bot that bugs us about broken code

Posted:
Written by:
Categories:

Our tech team spends a lot of time building and maintaining software codebases. These codebases include - but are of course not limited to - tools (such as OpenPrescribing), components of OpenSAFELY (such as Job Server and Job Runner) and ehrQL, the query language we designed.

We constantly introduce changes to our code. Often they’re about improving user experience (we love to hear feedback about how things can be improved!), and sometimes we update our software to fix bugs and keep things secure. Every code change has to undergo at least two processes: testing (to make sure the code works) and deployment (to make the changes live to our users).

We try to automate as much of the testing and deployment as we can. There are various tools for managing this automation (known as CI/CD - continuous integration and continuous delivery in the software world); we use GitHub Actions “workflows”. Each GitHub repository holding our platform code runs a number of custom workflows to automate tasks in our build, test and deployment cycles. Previously, we wrote about running automated generative tests for ehrQL, and how we would get Slack alerts if the tests fail.

In this blog post, we thought we would also showcase how we are alerted of any workflow failures occurring in the multiple codebases we maintain.

Meet the Bennett Bot

By default, when a workflow fails, GitHub would email the person triggering the workflow to notify them of the failure. While this is useful, we think it is a good idea for the whole team to have a basic overview of any breakages. So we configured a Slack bot to post a daily emoji dashboard for our workflows:

Dashboard example 01

At the start of each weekday, our diligent bot checks the latest status of all our core workflows and reports any failures to the tech team’s Slack channel. This allows us to be confident that we are aware of any breakages (or in the above example, flaky tests).

On some days, we might simply get alerted about pedantic spelling corrections …

Dashboard example 02

And on some days, we start our mornings with a pleasant message from the bot!

No workflow failures to report

We hope that this blog post has given you a glimpse into how we track the status of our automated workflows, and how that in turn allows us to be confident about the code that powers the tools and services at the Bennett Institute.

The code

If you would like to use Bennett Bot’s code to help you create your own bot on Slack, you can find the GitHub repository here.

Screenshot of the Bennett Bot repo