Track deploys by environment with Sleuth's first-class environment support!

Don Brown
August 7, 2020

Quick, do you know what code is currently deployed to production? How about staging? How far apart are these environments? Sleuth tracks your deployments, and today, Sleuth is launching first-class environments support. I'm going to show you how it works, steps to take to migrate your existing projects, and where we plan to take it in the future. (If you don't like reading blogs, watch my video above (or with this link) instead!)

Sleuth provides two environments for each of your projects: Production and Staging. You can add, remove, or rename environments, and change which environment is the default. These environments are now available for you to use in your deployments and impacts.

When creating or configuring a code deployment, you can choose to have one source code branch map to all environments or map multiple branches to multiple environments. The latter is useful if you use a GitFlow or similar branching strategy where the branch develop, for example, is deployed to staging, and the branch master is deployed to production.

How a code deploy is associated with an environment depends on how you register deploys. If you have Sleuth automatically create deploys when you push a commit or tag, Sleuth will check which environments are mapped to the related branch and create the appropriate deploys for those relevant environments. However, if you use a manual deploy approach where you send a webhook to Sleuth, you can optionally pass in the environment to the deploy it's meant for. If one isn't specified, the default environment is used.

Feature flag deployments work in a similar way: instead of mapping Sleuth environments to code branches, you map Sleuth environments to feature flag environments. Impacts such as error rates or metrics are then associated with a specific Sleuth environment.

With environments configured, you can start customizing how you consume deployments in Slack notifications. In the project configuration, you can map notifications from different environments to different Slack channels. For personal notifications, team members can configure which environments they want to be notified about. Once configured, your team members can now view what is deployed in each environment via the Sleuth Dashboard.

Personal Slack Notifications is one of my favorite Sleuth features, but it requires team members to go into their Sleuth accounts and associate their Slack and GitHub or Bitbucket accounts with Sleuth. You can see what accounts Sleuth is associated with in your Identities page.

For existing Sleuth customers, you'll notice some changes. First, we created the two default environments for you in each of your projects. Second, we mapped your code deployment target branch to every environment. For users of automatic commit- or tag-based deploys, this means you will get a code deploy registered in every environment automatically. For manual deploys, the deploy will be registered in the default environment for the project (i.e., Production). Impacts are now also mapped to the default environment.

Several customers were already trying to simulate environments by creating either projects or code deployments named by environment. The easiest way to migrate is to create a new project and set up your change sources to take full advantage of the new environments. Then, change your webhooks to send the environment along with the commit hash. However, this would mean you would lose deployment history information, so if that is an issue for you, please reach out to us either through the in-app chat, Slack, or our support email address to discuss how we can help migrate your data.

We are playing with several promising ideas on how to better use this new environment support to surface useful insights for your team. We think we can start to better answer questions such as, "What environments has this change been deployed to?", or "How far apart are my environments?", or "What is the status of a change as it flows through my environments?" We are also exploring taking environments beyond simply information sharing and into lightweight automation.

Login to Sleuth and give environments a try today, and as always, please don't hesitate to reach out to us through the in-app chat, Slack, our support email address, or leaving a comment below. We want to know how we could improve Sleuth to help you track deployments and impacts to help you deploy twice as fast, and safer.