Skip to content

Commit

Permalink
Add example of CICD with qa
Browse files Browse the repository at this point in the history
  • Loading branch information
b-per committed Jul 1, 2024
1 parent 3766f66 commit 1733edb
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ jobs:
run: pip install dbt-jobs-as-code~=0.6.0

- name: Run dbt-jobs-as-code
run: dbt-jobs-as-code plan jobs/jobs.yml
# or to template the jobs YAML file and only check the projects/environments from the project
# run: dbt-jobs-as-code plan jobs/jobs.yml --vars-yml vars_qa.yml --limit-projects-envs-to-yml
run: dbt-jobs-as-code plan jobs/jobs.yml --vars-yml jobs/vars_prod.yml --limit-projects-envs-to-yml
env:
DBT_API_KEY: "${{secrets.DBT_API_KEY}}"
# DBT_BASE_URL is optional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ jobs:
run: pip install dbt-jobs-as-code~=0.6.0

- name: Run dbt-jobs-as-code
run: dbt-jobs-as-code sync jobs/jobs.yml
# or to template the jobs YAML file and only check the projects/environments from the project
# run: dbt-jobs-as-code sync jobs/jobs.yml --vars-yml vars_qa.yml --limit-projects-envs-to-yml
run: dbt-jobs-as-code sync jobs/jobs.yml --vars-yml jobs/vars_prod.yml --limit-projects-envs-to-yml
env:
DBT_API_KEY: "${{secrets.DBT_API_KEY}}"
# DBT_BASE_URL is optional
Expand Down
31 changes: 31 additions & 0 deletions example_cicd/qa_plan_on_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Plan for syncing dbt Cloud Jobs from YAML
run-name: Running dbt-jobs-as-code plan to see what is going to be changed/deleted

on:
pull_request:
branches:
- qa
paths:
- 'jobs/**' # Only trigger the workflow if files under the jobs/ directory are modified

jobs:
run-python-script:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12.x"

- name: Install dbt-jobs-as-code
run: pip install dbt-jobs-as-code~=0.6.0

- name: Run dbt-jobs-as-code
run: dbt-jobs-as-code plan jobs/jobs.yml --vars-yml jobs/vars_qa.yml --limit-projects-envs-to-yml
env:
DBT_API_KEY: "${{secrets.DBT_API_KEY}}"
# DBT_BASE_URL is optional
# DBT_BASE_URL: "${{secrets.DBT_BASE_URL}}"
34 changes: 34 additions & 0 deletions example_cicd/qa_sync_on_merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Replicate dbt Cloud Jobs from YAML
run-name: Running dbt-jobs-as-code sync to replicate dbt Cloud jobs from YAML

on:
pull_request:
types:
- closed
branches:
- qa
paths:
- 'jobs/**' # Only trigger the workflow if files under the jobs/ directory are modified

jobs:
run-python-script:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12.x"

- name: Install dbt-jobs-as-code
run: pip install dbt-jobs-as-code~=0.6.0

- name: Run dbt-jobs-as-code
run: dbt-jobs-as-code sync jobs/jobs.yml --vars-yml jobs/vars_qa.yml --limit-projects-envs-to-yml
env:
DBT_API_KEY: "${{secrets.DBT_API_KEY}}"
# DBT_BASE_URL is optional
# DBT_BASE_URL: "${{secrets.DBT_BASE_URL}}"

0 comments on commit 1733edb

Please sign in to comment.