Skip to content

Commit

Permalink
Add short github ref to database name
Browse files Browse the repository at this point in the history
  • Loading branch information
bendnorman committed Nov 1, 2023
1 parent ab9425a commit 6592fad
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions docker/gcp_pudl_etl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function setup_dagster_storage() {
# Start dagster-storage Cloud SQL instance
gcloud sql instances patch dagster-storage --activation-policy=ALWAYS
# Create database
gcloud sql databases create "dagster-storage-$ACTION_SHA-$GITHUB_REF" --instance=dagster-storage
gcloud sql databases create "dagster-storage-$SHORT_GITHUB_REF" --instance=dagster-storage
}

function send_slack_msg() {
Expand Down Expand Up @@ -53,7 +53,7 @@ function shutdown_vm() {
upload_file_to_slack $LOGFILE "pudl_etl logs for $ACTION_SHA-$GITHUB_REF:"

# Delete dagster-storage database
gcloud sql databases delete "dagster-storage-$ACTION_SHA-$GITHUB_REF" --instance=dagster-storage
gcloud sql databases delete "dagster-storage-$SHORT_GITHUB_REF" --instance=dagster-storage
# Start dagster-storage Cloud SQL instance
gcloud sql instances patch dagster-storage --activation-policy=NEVER

Expand Down Expand Up @@ -94,6 +94,8 @@ function notify_slack() {
send_slack_msg "$message"
}

SHORT_GITHUB_REF=$(git rev-parse --short $GITHUB_REF)

# # Run ETL. Copy outputs to GCS and shutdown VM if ETL succeeds or fails
# 2>&1 redirects stderr to stdout.
run_pudl_etl 2>&1 | tee $LOGFILE
Expand Down

0 comments on commit 6592fad

Please sign in to comment.