Creating a deployment
Last updated
Last updated
A code deployment in Sleuth is mapped to a Git code repository and a branch. The repository/branch combination represents the changes your team is deploying to your environments.
Creating a code deployment is an easy 3 step process. Sleuth guides you through each step and it only takes about 1 - 2 minutes to configure. Creating a code deployment results in pulling in your last 30 days of deploys (DORA metrics) and leaves you fully setup to track your DORA metrics moving forward.
The 3 steps to create a code deployment are:
Enable Integrations
Add Code Deployment
Choose Tracking Type
Sleuth supports most code repository providers. Choose your code provider and Sleuth will walk you through connecting to your system either via App, OAuth or API key, depending on the provider.
Configuring a code deployment in Sleuth is simple. You just map the repository and branch that your team deploys from and away you go.
Sleuth is very flexible and will support the way that your team works. For teams that deploy the same branch to all pre-production and production environments you will just choose that branch on this screen.
However, some teams maintain a branch for each environment they deploy to. If this is how your team works you will click the checkbox that says Map separate branches to environments
This allows you to tell Sleuth which branch it should inspect for which environment.
Some teams will cut a release branch with a predictable name for each deployment they make. If your team works this way you can type in the prefix of the branch name you create and Sleuth will provide you with an option to track branches matching prefix
.
In this example Sleuth would look for changes on any branch that matches the prefix released
.
It's not uncommon for teams to maintain multiple deployable units of code in one large repository , this style of repository structure is called a Monorepo. Sleuth supports Monorepo's for code deployments.
The way to set up a Monorepo in Sleuth is to add one code deployment for each deployable unit of code within your Monorepo. When configuring the code deployment you will open the Advanced
settings and use the Source path prefix (include)
and the Source path prefix (exclude)
fields to tell Sleuth which parts of the repository to include or exclude. Once configured Sleuth will only register deploys that had changes made within the patterns defined.
Sleuth supports a number of ways to track your code deploys. The easiest, zero conf, way to start tracking is connecting Sleuth to your CI/CD system and letting Sleuth detect when you've made a deploy.
You can read more about all of the options for How to register a deploy.
By default Sleuth will initialize a code deployment with the last 30 days of deploys we can detect. This will allow you to quickly get a baseline of your DORA metrics for the last 30 days. Sleuth uses past events, based on the tracking type you've chosen to seed the initial deploys.
For instance, if you have connected up CircleCI and mapped your deploy jobs to Sleuth we will find all of the successful jobs run in the last 30 days and create deploys for those. Similarly, if you have chosen to manually tell Sleuth about deploys with a webhook we will use the last 30 days worth of pull requests to initialize your deploys.
Initializing more than 30 days worth of data is not a common thing teams require. It's a manual process and will take more effort on your part. If you do need to do so please make sure to follow the directions throughly.
For some teams 30 days of past data won't be enough to meet their needs. If you want to manually import past data into Sleuth it is possible but you must follow these steps, in the right order:
Create your code deployment
When selecting the tracking type choose Webhook
(Recommended) Import past deploys via a CSV file using the /import_deploys
endpoint
Import deploys one by one using the /register_deploy
endpoint
Once you're satisfied with how the older data looks inside of your code deployment you can edit the code deployment to have the Tracking type that you'd like moving forward.
If you run into trouble initializing the data you can always delete the deployment, re-create it and try populating again.
On the Using the webhook
confirmation screen open the Advanced
configuration and deselect the option that says Populate deploys from the last 4 weeks
Once the deployment has been created you will then need to manually register the past deploy SHA's with Sleuth in one of two ways using the APIs