So we made a bot that does stuff for us

Bertrand Magnien
Accor - Tech & Digital
6 min readMar 10, 2023

Because every release used to take us too much effort, we made a bot that replaces us, and works for us.

Photo by Ken Suarez on Unsplash

“Hey ! It’s RELEASE time, make sure everything is ok, and let’s deliver an awesome increment”

No matter if you are working on an API, a website, or a mobile app, releasing your code is always a pain if you don’t have a good process and a good tool to make it.

At Accor, in the Android app team, we used to spend more than 2 hours releasing each new version.

So we made a bot that releases our code on our behalf

Here comes “Risotto”, our “Release automation bot”

Risotto in person

The name Risotto comes from a french pun “Release auto” -> “Risotto”

Prerequisites to understand what comes below:

  • You have previously been asked to “release” a code based software.
  • Knowledge of global programming concepts such as CI/CD, Pull requests, Git flow …

Why a bot? Is releasing an application so hard ?!

Indeed, building and releasing an app is trivial.
Thousands of people have already faced this problem, and thousands of articles already exist on the web.
So why another publication about release automation?
Well, I hope you find something new here!

Here is what Risotto is capable of :

  • Starting the release on his own, every two weeks. Always on time.
  • Respecting our (something confusing) gitflow and branch naming conventions
  • Allowing for a few manual steps, reviewed on Github by human developers
  • Communicating with us through Slack messages, just like anyone else in our team.
  • Never complaining about repetitive and boring tasks
  • Never being sick nor in holidays.
    (Unless being under maintenances counts as being sick 🤔)

A few words about our technical stack

  • We use Bitrise for CI-CD
  • Our codebase is hosted on Github
  • We use Jira for issue tracking and visual management
  • The whole team uses Slack
Risotto and its interactions with external tools

To release the code, the team only interacts with Risotto, thanks to a slack bot.

Release start

Every two weeks, the Android team receives this message from Risotto :

Release starting on public channels

This is triggered by a customizable Slack Workflow, scheduled every two weeks, on Thursdays at 4pm.

The workflow can easily be modified by anyone. Especially when Thursday is a holiday, we can re-schedule the release as we see fit.
No code needed, no cron table, no pain.

Fail-proof configuration check

Our Risotto bot works with outgoing / incoming webhooks from Github and Bitrise.

The Risotto bot and server are hosted on an EC2 Amazon virtual machine, with IP address filtering. We don’t want any IP in the world to trigger a release of our app 🙃

What happens if Github or Bitrise decides to change its IP address?
A stuck and burnt Risotto in the pan!

For example, Github’s IP addresses can change from time to time. Risotto checks them thanks to the Github meta api, and warns people about future malfunctions.

⬅️ No issue | Some new IP ➡️

Release preparation

“Prepare the ingredients for a good Risotto”

Yum! This Risotto will be tasty source

Before releasing our app, the developer team must verify a few things :

  • Check that every previous bugfix has been merged into the main branch
  • Pull and embed some configuration files (retrieved from Firebase Remote Config)
  • Get the translations from Phrase (for new features) and embed them in the app. Verify that those translations are “correct”, in english and in our native language.

This is why Risotto creates a “preparation pull request”, validated by an appointed team member to read those messages.
Once merged, the recipe continues automatically, led by Risotto.

Note : Every two weeks, someone in the team is appointed as “The Cook 🧑‍🍳”, and is in charge of interacting with Risotto.

Build the app and release it (as a draft)

Message from Risotto asking to merge a lot of code

Nothing phenomenal.
Risotto generates a Pull Request on Github, verified by a Bitrise check with :

  • Unit tests
  • Lints

Once merged, a Bitrise workflow is triggered.
The workflow :

  • builds our app
  • drafts it on Google Play
  • creates a JIRA release, Github Release blah blah blah

Manual release verification / sanity checks

Once the build has ended and the release is ready to be tested, the Cook 🧑‍🍳 is responsible for doing some quick checks, ensuring this build is worth testing by the QA team.

Damn, I really need to change that button’s text

When the Cook gives his stamp of approval, the Risotto bot continues its tasks.

Release ends with great fanfare

When release ends on public channels

One of the most important things when releasing our app as a draft is communicating about it.

Risotto actually sends a lot of messages during the release:

  • In developers’ channels it sends verification steps, logs and errors.
  • In public channels with the whole team it sends announcement messages. When the release starts and when it ends.

To conclude

Since we adopted Risotto in our process, being the Cook 🧑‍🍳 for two weeks isn’t a chore anymore.

Here is the list of pain points solved by Risotto :

  • Developers used to need a how-to-release training to master every release step.
    => Not anymore, the bot knows the process for us.
  • The developer in charge was 100% focused on releasing for about 2 hours. He was hardly able to do anything else at the same time.
    => Not anymore, he’s just interrupted twice when manual steps are required.
  • We often started releasing late in the day, making team members work during the evening to finish what we started.
    => Not anymore, the release starts automatically, ignoring messages like “Wait, I want to merge that code before we release”
  • We sometimes forgot to warn the rest of the team about release completion.
    => Not anymore, the bot automatically sends messages on Slack to everyone.

Today we keep improving Risotto everytime we think something could be added to its scope of responsibilities.

Why did I write this story ?

You may have noticed that I haven’t detailed each of the 8 steps we need to perform in order to deliver a release, because this would probably be too specific to our team and processes.

I hope this story inspires you to create something new, something that suits your team perfectly.

From now on, if you see someone doing painful & repetitive jobs you could think about how it can be automatized. The more free time the team has, the better it becomes.

Please take the time to get feedback from your team, and… see how to add a bot that does the dirty job for you, while acting as a team member.

--

--

Bertrand Magnien
Accor - Tech & Digital

Solution Architect at Accor - Passionate developer - Creating new tools to ease team's life