How Turbo CI works
When Turbo CI is configured, an GitLab CI/CD Pipeline will trigger a TurboCI schedule in Paradime executing your configured dbt™️ command to run and test your dbt™️ changes.
paradime_turbo_ci_pr_ followed by the commit SHA number (e.g paradime_turbo_ci_pr_6d8f55c0). This will enabled you to see the results of your changes associated with the code in your pull request in your production data warehouse
Pre-requisites
Configure a custom schema for CI runs
Customize you dbt™️ schema generation at runtime, to make sure that when a PR is opened, Paradime Turbo CI will build and test your changed dbt™️ models in a temporary schema. We will want to update the dbt™️generate_schema_name.sql macro.
In your dbt™️ project, in your macros folder create a macro called: generate_schema_name.sql and use a similar logic as below, where when a Bolt run is executed using the ci target the schema where your models will be built will use the paradime_turbo_ci_pr prefix.
Deferral and State Comparison explained
When creating the Turbo CI job in Paradime, you can set your execution settings to defer to a previous run state by adding in thedeferred_schedule_slug configuration the slug of the Bolt production schedule you want to defer to
Paradime will look at the manifest.json from the specified schedule’s most recent successful run (unless setting the optional parameter successful_run_only: false) to determined the set of new and modified dbt™️ resources. In your Turbo CI commands, you can then use the state:modified+ argument to only run the modified resources and their downstream dependencies.
A common example is:
1. Configuring Bolt Turbo CI job
Setting up your Turbo CI Bolt Schedule is very similar to a normal bolt schedule with the addition of a couple more configurations. A Turbo CI job differ from a bolt schedule as it involves:- The Bolt schedule to defer to
- The
commandsto use thestate:modified+selector to build / tests only new dbt™️ models and their downstream dependencies. State comparison can only happen when there is a deferred schedule name configured to compare state to. - Being triggered by a pull request opened in your GitLab dbt™️ repository
Test Code Changes On Pull Requests
2. Create a GitLab Pipeline
Generate API keys and find you workspace token
To be able to trigger Bolt using the API, you will first need to generate API keys for your workspace. Got to account settings and generate your API keys, make sure to save in your password manager:- API key
- API secret
- API Endpoint
Generate Api Keys Legacy
.gitlab-ci.yml file at the root of your project your dbt™️ repository. Copy the code block below and enter the values required.
Example GitLab pipelines configuration file
Example GitLab pipelines configuration file
.gitlab-ci.yml
Add the API key and Credential in the GitLab variables
Finally you need to add the API key and credentials generated in the previous step in GitLab CI/CD pipelines. Set the corresponding values using your credentials for the variable names:PARADIME_API_KEYPARADIME_API_SECRETPARADIME_API_ENDPOINT
View Turbo CI run Logs
As per other bolt schedules, you can inspect run logs for each of the Turbo CI jobs running when a pull request is opened.Viewing Run Log History
