Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up CI in generated projects #19

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 %}