-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Require authentication for dry run function and run gcloud auth when …
…not logged in
- Loading branch information
Showing
4 changed files
with
65 additions
and
17 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -120,6 +120,15 @@ jobs: | |
- << pipeline.parameters.deploy >> | ||
steps: | ||
- checkout | ||
- &skip_forked_pr | ||
run: | ||
name: Early return if this build is from a forked PR | ||
command: | | ||
if [ -n "$CIRCLE_PR_NUMBER" ]; then | ||
echo "Cannot pass creds to forked PRs," \ | ||
"so marking this step successful" | ||
circleci-agent step halt | ||
fi | ||
- *restore_venv_cache | ||
- *build | ||
- run: | ||
|
@@ -129,6 +138,9 @@ jobs: | |
# since those tests take the longest to run and running those tests | ||
# in parallel speeds up CI | ||
command: | | ||
export GOOGLE_APPLICATION_CREDENTIALS="/tmp/gcp.json" | ||
echo "$GCLOUD_SERVICE_KEY" > "$GOOGLE_APPLICATION_CREDENTIALS" | ||
PATH="venv/bin:$PATH" script/entrypoint --black --flake8 \ | ||
--isort --mypy-ignore-missing-imports --pydocstyle \ | ||
-m "not (routine or sql or integration)" \ | ||
|
@@ -177,6 +189,7 @@ jobs: | |
condition: *validate-sql-or-routines | ||
steps: | ||
- checkout | ||
- *skip_forked_pr | ||
- *restore_venv_cache | ||
- *build | ||
- *attach_generated_sql | ||
|
@@ -203,6 +216,9 @@ jobs: | |
else | ||
PATHS="sql/bigquery-etl-integration-test" | ||
fi | ||
export GOOGLE_APPLICATION_CREDENTIALS="/tmp/gcp.json" | ||
echo "$GCLOUD_SERVICE_KEY" > "$GOOGLE_APPLICATION_CREDENTIALS" | ||
echo $PATHS | ||
PATH="venv/bin:$PATH" script/bqetl dryrun --validate-schemas $PATHS | ||
# yamllint enable rule:line-length | ||
|
@@ -239,13 +255,17 @@ jobs: | |
condition: *validate-sql | ||
steps: | ||
- checkout | ||
- *skip_forked_pr | ||
- *restore_venv_cache | ||
- *build | ||
- *attach_generated_sql | ||
- *copy_staged_sql | ||
- run: | ||
name: Verify that metadata files are valid | ||
command: | | ||
export GOOGLE_APPLICATION_CREDENTIALS="/tmp/gcp.json" | ||
echo "$GCLOUD_SERVICE_KEY" > "$GOOGLE_APPLICATION_CREDENTIALS" | ||
# TODO: Add check here to make sure all queries have metadata.yaml | ||
PATH="venv/bin:$PATH" script/bqetl query validate \ | ||
--respect-dryrun-skip | ||
|
@@ -260,15 +280,7 @@ jobs: | |
condition: *validate-bqetl | ||
steps: | ||
- checkout | ||
- &skip_forked_pr | ||
run: | ||
name: Early return if this build is from a forked PR | ||
command: | | ||
if [ -n "$CIRCLE_PR_NUMBER" ]; then | ||
echo "Cannot pass creds to forked PRs," \ | ||
"so marking this step successful" | ||
circleci-agent step halt | ||
fi | ||
- *skip_forked_pr | ||
- *restore_venv_cache | ||
- *build | ||
- run: | ||
|
@@ -289,6 +301,7 @@ jobs: | |
condition: *validate-sql | ||
steps: | ||
- checkout | ||
- *skip_forked_pr | ||
- *restore_venv_cache | ||
- *build | ||
- *attach_generated_sql | ||
|
@@ -301,6 +314,9 @@ jobs: | |
- run: | ||
name: Generate DAGs | ||
command: | | ||
export GOOGLE_APPLICATION_CREDENTIALS="/tmp/gcp.json" | ||
echo "$GCLOUD_SERVICE_KEY" > "$GOOGLE_APPLICATION_CREDENTIALS" | ||
mkdir -p /tmp/workspace/generated-sql/dags | ||
PATH="venv/bin:$PATH" script/bqetl dag generate --output-dir=/tmp/workspace/generated-sql/dags | ||
# this task is overwriting the content produced by generate-sql; | ||
|
@@ -407,13 +423,17 @@ jobs: | |
condition: *validate-sql-or-routines | ||
steps: | ||
- checkout | ||
- *skip_forked_pr | ||
- *restore_venv_cache | ||
- *build | ||
- *attach_generated_sql | ||
- *copy_staged_sql | ||
- run: | ||
name: Validate views | ||
command: PATH="venv/bin:$PATH" script/bqetl view validate | ||
command: | | ||
export GOOGLE_APPLICATION_CREDENTIALS="/tmp/gcp.json" | ||
echo "$GCLOUD_SERVICE_KEY" > "$GOOGLE_APPLICATION_CREDENTIALS" | ||
PATH="venv/bin:$PATH" script/bqetl view validate | ||
- unless: | ||
condition: *validate-sql-or-routines | ||
steps: | ||
|
@@ -453,11 +473,15 @@ jobs: | |
condition: *validate-sql-or-routines | ||
steps: | ||
- checkout | ||
- *skip_forked_pr | ||
- *restore_venv_cache | ||
- *build | ||
- run: | ||
name: Generate SQL content | ||
command: | | ||
export GOOGLE_APPLICATION_CREDENTIALS="/tmp/gcp.json" | ||
echo "$GCLOUD_SERVICE_KEY" > "$GOOGLE_APPLICATION_CREDENTIALS" | ||
# Check if the generated-sql branch can simply be re-used and SQL generation can be skipped. | ||
git clone -b generated-sql [email protected]:mozilla/bigquery-etl ~/remote-generated-sql | ||
cd ~/remote-generated-sql | ||
|
@@ -824,6 +848,7 @@ jobs: | |
condition: *validate-sql-or-routines | ||
steps: | ||
- checkout | ||
- *skip_forked_pr | ||
- run: | ||
name: Switch to main branch | ||
command: | | ||
|
@@ -838,6 +863,8 @@ jobs: | |
name: Generate SQL content | ||
command: | | ||
export PATH="venv/bin:$PATH" | ||
export GOOGLE_APPLICATION_CREDENTIALS="/tmp/gcp.json" | ||
echo "$GCLOUD_SERVICE_KEY" > "$GOOGLE_APPLICATION_CREDENTIALS" | ||
# Check if the generated-sql branch can simply be re-used and SQL generation can be skipped. | ||
# There is a delay between pushing changes to main and pushing a new generated-sql branch, | ||
|
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
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