Running this package as a CI check#
Once you have addressed all current misalignments in your project (either by fixing them or configuring exceptions), you can use this package as a CI check to ensure code changes don't introduce new misalignments. The setup will vary based on whether you are using dbt Cloud or dbt Core, but the general steps are as follows:
1. Override test severity with an environment variable#
By default the tests in this package are configured with "warn" severity, we can override that for our CI jobs with an environment variable:
-
Create an environment variable to define the appropriate severity for each environment. In dbt Cloud, for example, we can easily create an environment variable
DBT_PROJECT_EVALUATOR_SEVERITY
that is set to "error" for the Continuous Integration environment and "warn" for all other environments:Note: It is also possible to use an environment variable for dbt Core, but the actual implementation will depend on how dbt is orchestrated.
-
Update you project.yml file to override the default severity for all tests in this package:
2. Run this package for each pull request#
Now, you can run this package as a step of your CI job/pipeline. In dbt Cloud, for example, you could update the commands of your CI job to:
dbt build --select state:modified+ --exclude package:dbt_project_evaluator
dbt build --select package:dbt_project_evaluator
Or, if you've configured any exceptions, to:
dbt build --select state:modified+ --exclude package:dbt_project_evaluator
dbt build --select package:dbt_project_evaluator dbt_project_evaluator_exceptions
Note
Ensure you have properly set up your dbt Cloud CI job using deferral and a webhook trigger by following this documentation.