mozilla / bigquery-etl

Bigquery ETL

Home Page:https://mozilla.github.io/bigquery-etl

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Prompt GCP authentication flow

scholtzan opened this issue · comments

It would be convenient for users that are not logged in to have the gcloud auth flow prompted automatically. Currently, users that are not logged in will see an error message with instructions to perform the authentication themselves.

The tricky part here is that the authentication flow also needs to account for non-interactive environments where no browser is available (testing env, Airflow). We do not want runs in these environments to get stuck, so we need a way to exit runs if no credentials are available.

┆Issue is synchronized with this Jira Task

Currently, users that are not logged in will see an error message with instructions to perform the authentication themselves.

Currently users will only get that error message if they have no Google application default credentials at all. Once they've set application default credentials the first time they will no longer get that error message, even if their credentials have expired and they need to re-authenticate. I think different authentication detection logic is needed to handle expired credentials, as suggested in #5171.

The tricky part here is that the authentication flow also needs to account for non-interactive environments where no browser is available (testing env, Airflow). We do not want runs in these environments to get stuck, so we need a way to exit runs if no credentials are available.

Perhaps we could check for standard environment variables always set by CircleCI, Airflow, and/or GKE?