A Slackbot for Shipping Software: Meet Le Capitaine

Slackbot for software development - La Capitaine

At Unito, we believe that shipping software should be fun, easy, and done continuously. While we already had a mature deployment pipeline with CI and CD tools, we wanted to empower our team by building an assistant that would make it easier to follow our best practices. Since we’re huge fans of overcommunicating information asynchronously on Slack, it was a natural choice to build our solution as an interactive chatbot.

Introducing Le Capitaine, our very own foul-mouthed shipping assistant!

Le Capitaine Slackbot - Unito

We built the chatbot over a few weeks and have been using it exclusively to ship ever since. We’re rather proud of this cheeky little project and thought it would be fun to share how we’ve leveraged a bot to solve some of our common deployment friction points.

Knowing when to deploy

Our current CI (continuous integration) pipeline automatically builds the latest version of the master branch into a package that can be readily deployed manually. When you’re working with a lot of productive colleagues, code gets merged and built at a dizzying pace. This means that the live version of our services can sometimes be a few versions behind what’s available to deploy.

La Capitaine - CI Pipeline

That’s where Le Capitaine comes in:

By communicating with our AWS instances and comparing them with our latest CI builds, Le Capitaine is able to tell us what is currently in production and what’s not shipped yet. This allows us to make sure that we’re always running on the freshest version of our software.

La Capitaine - AWS Instances

But that’s not all!

Since we’re continuously running integration tests in our staging and production environments, Le Capitaine will deny deployment if tests are currently failing. This is a great safeguard against shipping unexpected regressions in production. It is possible to skip this check (say, you wish to deploy a fix for those very tests 😅) but Le Capitaine will log this event and will helpfully remind you that you should fix tests rather than skip them.

Standardizing release notes

Knowing what is being shipped in production is crucial for everyone. Developers love to see their hard work come to fruition. Data teams need to track changes in order to explain rises or drops in performance. Sales teams need to know about new features they can start selling. We achieve this by asynchronously posting every release (including a description of what’s being shipped) in our Slack #production channel. The thing is, crafting those messages can be tedious. 

Le Capitaine to the rescue!

Le Capitaine Slack bot - Standardizing release notes

Le Capitaine automatically uses Github’s API to create a list of changes in the build about to be deployed. It also links to the relevant pull requests so that developers can easily go peek at code changes. Furthermore, Le Capitaine will list what has changed when updating nested dependencies.

You’ll also notice that Unito is very emoji-forward: release lines are usually prefixed with an emoji indicating what the change does (🐛 for a bugfix, 🚑 for a time-sensitive hotfix, 🌪️ for a new feature, 💸 for debt, etc). This allows other teams to visually or programmatically parse our production channel for events that might affect them. 

Getting approval from contributors

You might have noticed that we tag (@) contributors in the release notes. This is because Le Capitaine will wait for a thumbs-up reaction from every contributor involved before executing the deployment. This makes sure that everyone involved knows that their code is being shipped. This is especially useful for monitoring, or for when there are external flags required before deploying a feature. You can also vote for someone else, in case they are not at their computer but they give you a verbal confirmation (such as when pair-programming).

La Capitaine Slackbot - Getting approval from contributors

Knowing what product to deploy where

Finally, Le Capitaine is especially useful because it knows how to deploy. As our infrastructure scales, we are building an increasingly complex architecture. Le Capitaine is fully aware of our interdependencies between projects and our load balancing strategies. It is also sensitive to not overriding progressive rollouts and non-master branches being deployed, so as to not interfere with currently running experiments.

Le Capitaine Slackbot - Deploying

All of this reduces the likelihood of making mistakes or forgetting steps, and empowers the team to deploy more boldly. This also means that everyone given access to Le Capitaine can easily ship, without having to dive into the AWS console. This is key to shipping fast and early: we love when our devs, from fresh hires to team leads, feel empowered to push their code in production as soon as possible.

Capitaines can fail too

“You just isolated a critical team responsibility, deployment, behind a service with a smattering of API dependencies and new failure modes that *will* break someday,” you, the reader, exclaims! And that’s true…but:

  1. We took good care to separate the interface from the capabilities, preserving the ability to trigger a deployment from a terminal (in addition to triggering from Slack).
  2. Bare-bones deployment via the AWS console is of course still possible, for those with access.

Most of all, Le Capitaine is delightful UX

At Unito, we just love to have fun and to make software that feels good to use, even for internal tools. Le Capitaine can be a bit harsh, but he’s always helpful and offers as-frictionless-as-possible UX. 

Some examples are:

Errors are always accompanied by a suggestion on what to do. 

Le Capitaine - Unito

Bypassing rules leads to light-hearted shaming when you’re about to deploy (as you saw earlier). These are also logged for security reasons when the deployment is actually forced:

Le Capitaine - shaming

What’s next?

Le Capitaine is a work in progress and we’ll always keep adding features to him so that the whole shipping experience is as pleasant, safe, and efficient as possible for the whole team. While Le Capitaine is currently wrapped up in a project with multiple internal Slackbots, we would love to make him open source eventually. Let us know if you’re interested! 

Like what we’re doing at Unito? Come join our team!