In this video, we will be creating the Production and CI/CD Environments that our jobs will run on.
Summary of this video:
New Environment
. Name the Environment. Keep the Deployment
type and the default dbt version (which is always the latest stable version). Use your user’s Redshift credentials for the Deployment environment and called the schema analytics
.qa
.In this video, we will be adding a Pull Request Template and creating the Production and CI/CD jobs.
Summary of this video:
create new branch
. Name the branch feature/add_pull_request_template
..github
at the same level as the analysis folder.Create a new file in the folder called pull_request_template.md
. Paste the following pull request template in.
<!---
Provide a short summary in the Title above. Examples of good PR titles:
* "Feature: add so-and-so models"
* "Fix: deduplicate such-and-such"
* "Update: dbt version 0.20.0"
-->
## Description & motivation
<!---
Describe your changes, and why you're making them. Is this linked to an open
issue, a Trello card, or another pull request? Link it here.
-->
## Changes to existing models:
<!---
Include this section if you are changing any existing models. Link any related
pull requests on your BI tool, or instructions for merge (e.g. whether old
models should be dropped after merge, or whether a full-refresh run is required)
-->
## Screenshots (DAG, query results):
<!---
Include a screenshot of the relevant section of the updated DAG and if you've
created a new model, then show us the results when you query the model. To see
your version of the DAG, run `dbt docs generate && dbt docs serve`.
-->
## Validation of models:
<!---
All PRs should have a test criteria to confirm that the quality of their changes,
which should have been established in your task card. This might look like a
link to an in-development Looker dashboard or a query that compares an existing
model with a new one.
-->
## Checklist:
<!---
This checklist is mostly useful as a reminder of small things that can easily be
forgotten – it is meant as a helpful tool rather than hoops to jump through.
Put an `x` in all the items that apply, make notes next to any that haven't been
addressed, and remove any items that are not relevant to this PR.
-->
- [ ] My pull request represents one logical piece of work.
- [ ] My commits are related to the pull request and look clean.
- [ ] My SQL follows the [dbt Labs style guide](https://github.com/dbt-labs/corp/blob/master/dbt_style_guide.md).
- [ ] I have materialized my models appropriately.
- [ ] I have added appropriate tests and documentation to any new models or fields.
Save the file by clicking on Save or CMD+S/Ctrl+S
Click on Open Pull Request
Fill out the Pull Request template and Merge in the Pull Request.
Delete the existing branch.
Now go back to dbt Cloud. Go to Jobs by clicking on the hamburger and click on Jobs.
Click on New Job
for a new Production Job.
Fill out the form this way:
Name the job Production Daily
.
Choose the Production Environment.
Check off generate docs.
Add a new command dbt test
under the dbt run
command.
Update the schedule to run every 12 hours.
Click off the Production job by clicking on Run Now
Take a look through the run steps. Take a look at each step and view the documentation site the run generated.
Now create the CI/CD job. To do this, fill out the form in this way:
Name the job: CI/CD
Choose the CI/CD Environment
Check off generate docs
Defer to the Production Daily run state
Update the dbt run command to dbt run -m state:modified+
Add a new command dbt test -m state:modified+
under the dbt run command.
Uncheck the Run on Schedule
and check Run on Pull Request