Skip to content

Commit

Permalink
chore: analytics secure transforms call
Browse files Browse the repository at this point in the history
  • Loading branch information
katebygrace committed Mar 25, 2024
1 parent b325997 commit b8ac6d0
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
1 change: 1 addition & 0 deletions dataeng/jobs/analytics/ModelTransfers.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class ModelTransfers{
}
publishers common_publishers(allVars)
steps {
shell(dslFactory.readFileFromWorkspace('dataeng/resources/dbt-password.sh'))
shell(dslFactory.readFileFromWorkspace('dataeng/resources/model-transfers.sh'))
}
}
Expand Down
21 changes: 21 additions & 0 deletions dataeng/resources/dbt-password.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
secret_to_call="analytics-secure/warehouse-transforms/profiles"
secret_name="DBT_PASSWORD"
set +x

SECRET_JSON=$(aws secretsmanager get-secret-value --secret-id $secret_to_call --region "us-east-1" --output json)
# Check the exit status of the AWS CLI command

extract_and_store_secret_value() {

value=$(echo "$SECRET_JSON" | jq -r ".SecretString | fromjson.$secret_name" 2>/dev/null)
eval "$secret_name"='$value'
}
if [ $? -eq 0 ]; then
# Use jq to extract the values from the JSON response
extract_and_store_secret_value $SECRET_JSON $secret_name
else
echo "AWS CLI command failed"
fi

echo $value
6 changes: 4 additions & 2 deletions dataeng/resources/model-transfers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ fi

ARGS="{mart: ${MART_NAME} }"

dbt deps --profiles-dir $WORKSPACE/analytics-secure/warehouse-transforms/ --profile $DBT_PROFILE --target $DBT_TARGET

dbt deps --profiles-dir $WORKSPACE/profiles/ --profile $DBT_PROFILE --target $DBT_TARGET


# Call DBT to perform all transfers for this mart.
dbt run-operation perform_s3_transfers --args "${ARGS}" --profile $DBT_PROFILE --target $DBT_TARGET --profiles-dir $WORKSPACE/analytics-secure/warehouse-transforms/
dbt run-operation perform_s3_transfers --args "${ARGS}" --profile $DBT_PROFILE --target $DBT_TARGET --profiles-dir $WORKSPACE/profiles/

0 comments on commit b8ac6d0

Please sign in to comment.