call datashare grants as last step of deployment

This commit is contained in:
Desmond Hui 2023-10-17 09:44:25 -07:00 committed by Julius Remigio
parent 01e3e3d112
commit 0fcef849fb

View File

@ -20,6 +20,43 @@ on:
jobs:
run_dbt_jobs:
runs-on: ubuntu-latest
environment:
name: ${{ inputs.environment }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v1
with:
python-version: "3.7.x"
- name: overwrite env vars
if: ${{ env.USE_VARS == 'TRUE' }}
run: |
echo "DBT_VERSION=${{ vars.DBT_VERSION }}" >> $GITHUB_ENV
echo "DBT_PROFILES_DIR=${{ vars.DBT_PROFILES_DIR }}" >> $GITHUB_ENV
echo "ACCOUNT=${{ vars.ACCOUNT }}" >> $GITHUB_ENV
echo "ROLE=${{ vars.ROLE }}" >> $GITHUB_ENV
echo "USER=${{ vars.USER }}" >> $GITHUB_ENV
echo "REGION=${{ vars.REGION }}" >> $GITHUB_ENV
echo "DATABASE=${{ vars.DATABASE }}" >> $GITHUB_ENV
echo "SCHEMA=${{ vars.SCHEMA }}" >> $GITHUB_ENV
- name: install dependencies
run: |
pip3 install dbt-snowflake==${{ env.DBT_VERSION }} cli_passthrough requests click
dbt deps
- name: Run DBT Jobs
run: |
${{ inputs.dbt_command }}
- name: Run datashare model
run: |
cnt=$(dbt ls -m fsc_utils.datashare._datashare___create_gold | wc -l ); if [ $cnt -eq 1 ]; then dbt run -m fsc_utils.datashare._datashare___create_gold; fi;
dbt run-operation run_query --args "{sql: call admin.datashare.sp_grant_share_permissions('${{ env.DATABASE }}')}"
dbt:
uses: ./.github/workflows/dbt.yml
secrets: inherit