Skip to content

Commit

Permalink
Merge pull request #19 from cagov/use-prd-target-for-docs
Browse files Browse the repository at this point in the history
Clean up CI in generated projects
  • Loading branch information
britt-allen authored Oct 25, 2023
2 parents cd60a7f + 407915a commit be80489
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 8 deletions.
6 changes: 3 additions & 3 deletions {{project_name}}/.github/workflows/docs.yml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ env:
DBT_PROFILES_DIR: transform/ci
{% if dbt_target == 'Snowflake' %}
{% raw %}
PRIVATE_KEY: ${{ SECRETS.SNOWFLAKE_PRIVATE_KEY }}
SNOWFLAKE_USER: ${{ SECRETS.SNOWFLAKE_USER }}
PRIVATE_KEY: ${{ SECRETS.SNOWFLAKE_PRIVATE_KEY_PRD }}
SNOWFLAKE_USER: ${{ SECRETS.SNOWFLAKE_USER_PRD }}
SNOWFLAKE_ACCOUNT: ${{ SECRETS.SNOWFLAKE_ACCOUNT }}
{% endraw %}
SNOWFLAKE_PRIVATE_KEY_PATH: /tmp/private_key.p8
Expand Down Expand Up @@ -61,6 +61,6 @@ jobs:
- name: Build dbt docs
run: |
dbt deps --project-dir=transform
dbt docs generate --project-dir=transform
dbt docs generate --project-dir=transform --target=prd
cp -r transform/target docs/dbt_docs
- run: mkdocs gh-deploy --force
4 changes: 2 additions & 2 deletions {{project_name}}/.github/workflows/pre-commit.yml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ env:
DBT_PROFILES_DIR: ci
{% if dbt_target == 'Snowflake' %}
{% raw %}
PRIVATE_KEY: ${{ SECRETS.SNOWFLAKE_PRIVATE_KEY }}
SNOWFLAKE_USER: ${{ SECRETS.SNOWFLAKE_USER }}
PRIVATE_KEY: ${{ SECRETS.SNOWFLAKE_PRIVATE_KEY_DEV }}
SNOWFLAKE_USER: ${{ SECRETS.SNOWFLAKE_USER_DEV }}
SNOWFLAKE_ACCOUNT: ${{ SECRETS.SNOWFLAKE_ACCOUNT }}
{% endraw %}
SNOWFLAKE_PRIVATE_KEY_PATH: /tmp/private_key.p8
Expand Down
6 changes: 3 additions & 3 deletions {{project_name}}/.pre-commit-config.yaml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ repos:
hooks:
- name: Dbt deps
id: dbt-deps
language: python
entry: dbt deps --project-dir=transform
language: system
entry: poetry run dbt deps --project-dir transform
always_run: false
pass_filenames: false
types: [sql]
Expand All @@ -43,7 +43,7 @@ repos:
hooks:
- id: sqlfluff
name: sqlfluff
language: python
language: system
description: "Lints sql files with `SQLFluff`"
types: [sql]
require_serial: true
Expand Down
23 changes: 23 additions & 0 deletions {{project_name}}/transform/ci/profiles.yml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,27 @@ config:
database: ANALYTICS_DEV
schema: ci_should_not_create_this_schema
threads: 4
{% endif %}
prd:
{% if dbt_target == 'BigQuery' %}
type: bigquery
method: oauth
{% raw %}
project: "{{ env_var('GCP_PROJECT') }}"
{% endraw %}
# Should not be created in CI as the CI service account is read-only!
dataset: analytics
threads: 4
{% elif dbt_target == 'Snowflake' %}
type: snowflake
{% raw %}
account: "{{ env_var('SNOWFLAKE_ACCOUNT') }}"
user: "{{ env_var('SNOWFLAKE_USER') }}"
private_key_path: "{{ env_var('SNOWFLAKE_PRIVATE_KEY_PATH') }}"
{% endraw %}
role: READER_PRD
warehouse: REPORTING_XS_PRD
database: ANALYTICS_PRD
schema: ANALYTICS
threads: 4
{% endif %}

0 comments on commit be80489

Please sign in to comment.