Skip to content

Commit

Permalink
Fix Credentials sent via env (#9071)
Browse files Browse the repository at this point in the history
* Fix Credentials sent via env

* add new env var

* fix lint

* Add Comment
  • Loading branch information
ayush-shah authored Nov 30, 2022
1 parent 42fe861 commit 2b2eadf
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/py-cli-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ jobs:
env:
E2E_TEST: ${{ matrix.e2e-test }}
E2E_BQ_PROJECT_ID: ${{ secrets.E2E_BQ_PROJECT_ID }}
E2E_BQ_PRIVATE_KEY: ${{ secrets.E2E_BQ_PRIVATE_KEY }}
run: |
source env/bin/activate
python -m pytest -c ingestion/setup.cfg ingestion/tests/cli_e2e/test_cli_$E2E_TEST.py
Expand Down
2 changes: 2 additions & 0 deletions ingestion/src/metadata/utils/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ def build_google_credentials_dict(gcs_values: GCSValues) -> Dict[str, str]:
:return: Dictionary with credentials
"""
private_key_str = gcs_values.privateKey.get_secret_value()
# adding the replace string here to escape line break if passed from env
private_key_str = private_key_str.replace("\\n", "\n")
validate_private_key(private_key_str)

return {
Expand Down
2 changes: 1 addition & 1 deletion ingestion/tests/cli_e2e/database/bigquery/bigquery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ source:
type: service_account
projectId: $E2E_BQ_PROJECT_ID
privateKeyId: $CYPRESS_BQ_PRIVATE_KEY_ID
privateKey: $CYPRESS_BQ_PRIVATE_KEY
privateKey: $E2E_BQ_PRIVATE_KEY
clientEmail: $CYPRESS_BQ_CLIENT_EMAIL
clientId: $CYPRESS_BQ_CLIENT_ID
sourceConfig:
Expand Down

0 comments on commit 2b2eadf

Please sign in to comment.