Skip to content

Commit

Permalink
Try using not-sudo, and add logs to slack output.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdangerx committed Jan 8, 2024
1 parent e6e6aac commit 8963cf7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-deploy-pudl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ jobs:
# Start the batch job
- name: Kick off batch job
run: gcloud batch jobs submit --job-prefix run-etl-test --config ${{ env.BATCH_JOB_JSON }} --location us-west1
run: gcloud batch jobs submit run-etl-${{ env.BUILD_ID }} --config ${{ env.BATCH_JOB_JSON }} --location us-west1

- name: Post to a pudl-deployments channel
id: slack
Expand Down
14 changes: 9 additions & 5 deletions docker/gcp_pudl_etl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ function authenticate_gcp() {

function initialize_postgres() {
echo "initializing postgres"
sudo -u postgres pg_ctl start -l logfile && \
sudo -u postgres psql -c "CREATE USER dagster WITH SUPERUSER PASSWORD 'dagster_password'"
su - postgres 'pg_ctl start -l logfile' && \
su - postgres 'psql -c "CREATE USER dagster WITH SUPERUSER PASSWORD 'dagster_password'"'
}

function run_pudl_etl() {
Expand Down Expand Up @@ -101,16 +101,20 @@ function zenodo_data_release() {
function notify_slack() {
# Notify pudl-builds slack channel of deployment status
if [[ "$1" == "success" ]]; then
message=":large_green_circle: :sunglasses: :unicorn_face: :rainbow: The deployment succeeded!! :partygritty: :database_parrot: :blob-dance: :large_green_circle:\n\n "
message=":large_green_circle: :sunglasses: :unicorn_face: :rainbow: The deployment succeeded!! :partygritty: :database_parrot: :blob-dance: :large_green_circle:\n\n"
elif [[ "$1" == "failure" ]]; then
message=":x: Oh bummer the deployment failed :fiiiiine: :sob: :cry_spin: :x:\n\n "
message=":x: Oh bummer the deployment failed :fiiiiine: :sob: :cry_spin: :x:\n\n"
else
echo "Invalid deployment status"
exit 1
fi
message+="See https://console.cloud.google.com/storage/browser/builds.catalyst.coop/$BUILD_ID for logs and outputs."
message+="Logs at https://console.cloud.google.com/batch/jobsDetail/regions/us-west1/jobs/$BUILD_ID/logs?project=catalyst-cooperative-pudl\n\n"
message+="See https://console.cloud.google.com/storage/browser/builds.catalyst.coop/$BUILD_ID for outputs."

send_slack_msg "$message"
if [[ "$1" == "failure" ]]; then
exit 1
fi
}

function update_nightly_branch() {
Expand Down

0 comments on commit 8963cf7

Please sign in to comment.