-
-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve flexibility for publishing options #2964
Merged
Merged
Changes from 4 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
d316743
Introduce GCP_OUTPUT env variable.
rousik c6ad306
Rename variable to PUDL_GCS_OUTPUT
rousik 794eef4
Merge remote-tracking branch 'origin/dev' into custom-gcs-output
rousik ada7664
Publish nightly builds as YYYY-MM-DD-hhmm-${sha}-$
rousik 1ef6491
Merge remote-tracking branch 'origin/dev' into custom-gcs-output
rousik f066781
Use short shas for output directories.
rousik 6a47bd3
Move gcs output after the notifications
rousik cc0bbcc
Create success file in output when ETL is okay
rousik cd7ff93
Merge remote-tracking branch 'origin/dev' into custom-gcs-output
rousik 3758dbc
Fix path to etl config.
rousik d85da7a
Merge branch 'dev' into custom-gcs-output
rousik cdecdde
Update conda-lock.yml and rendered conda environment files.
rousik df8347f
Move copy before publishing and wipe success file.
rousik 38d3837
Merge branch 'dev' into custom-gcs-output
zaneselvans a519e97
Explain some arcane bash magic with a comment.
zaneselvans File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,8 @@ | |
# This script runs the entire ETL and validation tests in a docker container on a Google Compute Engine instance. | ||
# This script won't work locally because it needs adequate GCP permissions. | ||
|
||
: "${PUDL_GCS_OUTPUT:=gs://nightly-build-outputs.catalyst.coop/$ACTION_SHA-$GITHUB_REF}" | ||
zaneselvans marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
set -x | ||
|
||
function send_slack_msg() { | ||
|
@@ -41,7 +43,6 @@ function run_pudl_etl() { | |
|
||
function shutdown_vm() { | ||
# Copy the outputs to the GCS bucket | ||
gsutil -m cp -r $PUDL_OUTPUT "gs://nightly-build-outputs.catalyst.coop/$ACTION_SHA-$GITHUB_REF" | ||
|
||
upload_file_to_slack $LOGFILE "pudl_etl logs for $ACTION_SHA-$GITHUB_REF:" | ||
|
||
|
@@ -54,6 +55,11 @@ function shutdown_vm() { | |
curl -X POST -H "Content-Length: 0" -H "Authorization: Bearer ${ACCESS_TOKEN}" https://compute.googleapis.com/compute/v1/projects/catalyst-cooperative-pudl/zones/$GCE_INSTANCE_ZONE/instances/$GCE_INSTANCE/stop | ||
} | ||
|
||
function copy_outputs_to_gcs() { | ||
echo "Copying outputs to GCP bucket $PUDL_GCS_OUTPUT" | ||
gsutil -m cp -r $PUDL_OUTPUT ${PUDL_GCS_OUTPUT} | ||
} | ||
|
||
function copy_outputs_to_distribution_bucket() { | ||
echo "Copying outputs to GCP distribution bucket" | ||
gsutil -m -u $GCP_BILLING_PROJECT cp -r "$PUDL_OUTPUT/*" "gs://pudl.catalyst.coop/$GITHUB_REF" | ||
|
@@ -89,8 +95,12 @@ run_pudl_etl 2>&1 | tee $LOGFILE | |
# Notify slack if the etl succeeded. | ||
if [[ ${PIPESTATUS[0]} == 0 ]]; then | ||
notify_slack "success" | ||
copy_outputs_to_gcs | ||
rousik marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# Dump outputs to s3 bucket if branch is dev or build was triggered by a tag | ||
# TODO: this behavior should be controlled by on/off switch here and this logic | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agree - having the action just pass in a switch would be nice. I think at some point we should replace this whole nightly build harness with a Python script that's more robust and that would be a nice time to fix this too. |
||
# should be moved to the triggering github action. Having it here feels | ||
# fragmented. | ||
if [ $GITHUB_ACTION_TRIGGER = "push" ] || [ $GITHUB_REF = "dev" ]; then | ||
copy_outputs_to_distribution_bucket | ||
fi | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL about the block chomping operator. Does GHA complain when there's an extra newline at the end here?