@@ -0,0 +1,66 @@
|
|||||||
|
definitions:
|
||||||
|
steps:
|
||||||
|
- step: &terraform_plan_apply
|
||||||
|
name: "Plan and Apply Terraform"
|
||||||
|
image: zenika/terraform-aws-cli:latest
|
||||||
|
script:
|
||||||
|
- terraform --version
|
||||||
|
# terraform steps here
|
||||||
|
# trigger: automatic # uncomment after testing
|
||||||
|
trigger: manual
|
||||||
|
caches:
|
||||||
|
- terraform
|
||||||
|
- step: &snowflake_deploy
|
||||||
|
name: "Deploy Snowflake Changes"
|
||||||
|
image: python:3.7
|
||||||
|
size: 2x
|
||||||
|
script:
|
||||||
|
- python -m pip install --upgrade pip
|
||||||
|
- pip install snowflake-connector-python
|
||||||
|
- pip install schemachange --upgrade
|
||||||
|
# Setting the database name dynamically based on the branch name
|
||||||
|
- if [ "$BITBUCKET_BRANCH" == "DEV" ]; then export SNOWFLAKE_DATABASE=$DEV_SNOWFLAKE_DATABASE; fi
|
||||||
|
- if [ "$BITBUCKET_BRANCH" == "UAT" ]; then export SNOWFLAKE_DATABASE=$UAT_SNOWFLAKE_DATABASE; fi
|
||||||
|
- if [ "$BITBUCKET_BRANCH" == "PROD" ]; then export SNOWFLAKE_DATABASE=$PROD_SNOWFLAKE_DATABASE; fi
|
||||||
|
- schemachange -a $SNOWFLAKE_ACCOUNT -u $SNOWFLAKE_USER -r $SNOWFLAKE_ROLE -w $SNOWFLAKE_WAREHOUSE -d $SNOWFLAKE_DATABASE -c $SNOWFLAKE_DATABASE.SCHEMACHANGE.CHANGE_HISTORY --create-change-history-table -v
|
||||||
|
# trigger: automatic # uncomment after testing
|
||||||
|
trigger: manual
|
||||||
|
caches:
|
||||||
|
- pip
|
||||||
|
|
||||||
|
pipelines:
|
||||||
|
branches:
|
||||||
|
dev:
|
||||||
|
- step:
|
||||||
|
<<: *terraform_plan_apply
|
||||||
|
condition:
|
||||||
|
changesets:
|
||||||
|
includePaths:
|
||||||
|
- terraform/dev/**/*
|
||||||
|
- step:
|
||||||
|
<<: *snowflake_deploy
|
||||||
|
condition:
|
||||||
|
paths:
|
||||||
|
- snowflake/**/*.sql
|
||||||
|
uat:
|
||||||
|
- step:
|
||||||
|
<<: *terraform_plan_apply
|
||||||
|
condition:
|
||||||
|
paths:
|
||||||
|
- terraform/uat/**/*
|
||||||
|
- step:
|
||||||
|
<<: *snowflake_deploy
|
||||||
|
condition:
|
||||||
|
paths:
|
||||||
|
- snowflake/**/*.sql
|
||||||
|
prod:
|
||||||
|
- step:
|
||||||
|
<<: *terraform_plan_apply
|
||||||
|
condition:
|
||||||
|
paths:
|
||||||
|
- terraform/prod//**/*
|
||||||
|
- step:
|
||||||
|
<<: *snowflake_deploy
|
||||||
|
condition:
|
||||||
|
paths:
|
||||||
|
- snowflake/**/*.sql
|
||||||
Reference in New Issue
Block a user