Using Slack, AWS, and GitHub to find my commits

Where are they?!

Nina Yang · Sep 6, 2019

Searching for my commits

Photo by Katerina Kerdi on Unsplash

If your continuous deployment process involves a pre-production environment (or two), I’m sure you’ve run into the following situation: You merge a bug fix into master. After patting yourself on the back, you garbage-collect all the information about the fix from your mind and move on to the next ticket. Moments or days later, someone asks you when your fix will make it to prod. You respond with a blank stare.

This happens to me all the time at Transposit. Though our deploy process is pretty simple (code blocks bake on staging environments for about two days until they’re deployed to prod), I don’t want to mentally keep track of where each of my commits are.

When asked when one of my bug fixes would make it to prod, my answer would always be “uh… let me check”. I would then have to look up the head commit deployed on each environment that day, cross-reference it with the visual list of commits on GitHub to see which block of commits mine was in, then remember what day it was and add the appropriate amount of bake days (we don’t deploy to prod over the weekend) to return an answer to my colleague. An answer that, with all the manual steps, I was only 90% confident in.

After repeating this process a hundred too many times, I had the epiphany that maybe life didn’t have to be this difficult: that I could automate the checking with a Transposit app. My coworker Yoko had actually already written an app that looks up the head commit on each environment in AWS and posts it to Slack. All I had to do was steal borrow fork that code and add some GitHub logic!

Automation with Slack, GitHub, and AWS ECS

Everyone’s deployment process is its own unique snowflake, so your deployment process probably doesn’t look like mine. But the ideas are all ones you can steal borrow fork. I’ll walk through the inner workings of the app I built, and I hope it gets you thinking about what parts of your workflows you can automate.

The entry point is a Slack slash command, /findmycommits. Slack was the natural interface for this app, as my team uses it religiously throughout the day and Transposit has great Slack support.

The slash command’s corresponding webhook points to a Transposit operation. Slack kindly provides us the querying user’s Slack ID, and we can easily map that to the Transposit team member.

Now comes the fun part. The app uses Transposit’s AWS ECS connector to fetch the head commits on each of the environments (thanks again, Yoko!). Separately, it fetches all the recent commits to master from GitHub. It then maps the user’s commits and the ECS commits to their respective indices in the recent commits list. By comparing indices, we can tell exactly where each of the user’s commits are.

Are we done? Not quite. The important information is not actually where the commit is, but when it will be in production (I realize this makes my app name a bit of a misnomer, but /whenwillmycommitsmakeittoprod wasn’t as catchy). After using the AWS Cloudwatch Events connector to check if prod deployment is enabled, the app writes a summary of each commit’s whereabouts. For fun, and because I love our mascot, I decorate each message with the appropriate Iggy emoji (users can turn this feature off in their user settings page).

Find my commits settings page

Deploy disabled with ghastly Iggy

Finally, I augmented this app so it can be used to find the whereabouts of a teammate’s commits. This gets triggered by @mentioning the teammate as an argument to the slash command. It seemed like a good add-on, particularly for product managers who are trying to track the status of bug fixes. The implementation was simple. All users provide their Slack and GitHub credentials to the app, so when you’re looking up the commits for another Slack user, we can map their Slack ID to their GitHub username to find their commits.

Finding the commits of another user

heart emoji

I love this app. I love that I no longer have to hunt down the location of my commits one by one. I also love that I was able to build something that aggregates from multiple sources to provide valuable information for me and my team.

I hope Transposit can help you build an app that you’ll love too! And you can use my app as a starting point.