From 0afeb76636a4164422409212558fe6c080ea08c9 Mon Sep 17 00:00:00 2001 From: Noel Gomez Date: Sat, 11 Nov 2023 10:52:03 -0800 Subject: [PATCH] fix CD script --- .github/workflows/main.yml | 9 ++++++--- automate/blue_green_run.py | 9 --------- ...phanate_relations.sql => drop_orphaned_relations.sql} | 4 ++-- 3 files changed, 8 insertions(+), 14 deletions(-) rename transform/macros/tooling/ci-cd/{drop_orphanate_relations.sql => drop_orphaned_relations.sql} (96%) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index be4e07c6..2f53e7c3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -51,9 +51,6 @@ jobs: id: prod-manifest run: "../automate/dbt/get_artifacts.sh" - - name: Generate dbt documentation - run: "dbt docs generate" - - name: Run blue / green deployment id: run-blue-green env: @@ -66,12 +63,18 @@ jobs: - name: Delete merged test databases run: "../automate/dbt/remove_test_databases.sh" + - name: Generate dbt documentation + run: "dbt docs generate" + - name: Deploy docs 🚀 uses: JamesIves/github-pages-deploy-action@4.1.4 with: branch: dbt-docs folder: transform/target + - name: Upload dbt artifacts + run: "dbt run-operation upload_artifacts" + - uses: fregante/setup-git-user@v2 - name: Bump dbt project and git project version run: "../automate/dbt/bump_dbt_project.sh" diff --git a/automate/blue_green_run.py b/automate/blue_green_run.py index 03c71c7f..1a418338 100755 --- a/automate/blue_green_run.py +++ b/automate/blue_green_run.py @@ -79,15 +79,6 @@ def main(is_ci_cd_run: bool = False, selector: str = None, target: str = None): run_command(f'dbt-coves dbt -- run-operation drop_staging_db --args "{STAGING_DB_ARGS}" {dbt_target}') logging.info("done with dropping!!!!") - # Save the latest manifest to snowflake stage - os.environ["DATACOVES__MAIN__DATABASE"] = DBT_FINAL_DB_NAME - run_command(f"dbt-coves dbt -- compile {dbt_target}") - - os.environ["DATACOVES__MAIN__DATABASE"] = DBT_FINAL_DB_NAME - - logging.info("Uploading new prod manifest") - run_command(f"dbt-coves dbt -- --no-write-json run-operation upload_artifacts {dbt_target}") - def run_dbt(selector: str = None, dbt_target: str = None, is_ci_cd_run: bool = False): """ diff --git a/transform/macros/tooling/ci-cd/drop_orphanate_relations.sql b/transform/macros/tooling/ci-cd/drop_orphaned_relations.sql similarity index 96% rename from transform/macros/tooling/ci-cd/drop_orphanate_relations.sql rename to transform/macros/tooling/ci-cd/drop_orphaned_relations.sql index c05e23d8..0d27b0d8 100644 --- a/transform/macros/tooling/ci-cd/drop_orphanate_relations.sql +++ b/transform/macros/tooling/ci-cd/drop_orphaned_relations.sql @@ -3,10 +3,10 @@ {# Macro for deleting objects from the data warehouse that are no longer in dbt. #} {# - dbt run-operation drop_orphanate_relations --args '{"dry_run": true}' + dbt run-operation drop_orphaned_relations --args '{"dry_run": true}' #} -{%- macro drop_orphanate_relations(dry_run='true') -%} +{%- macro drop_orphaned_relations(dry_run='true') -%} {%- if execute -%}