Skip to content

Commit 493adff

Browse files
Fix GCP bucket upload (#258)
* Google Cloud Bucket upload fails Fixes #257 * No-change * Add perms * Use GCP creds * Move GCP auth code to main action * Try WIF again * No-change * Re-add test script * No-change * No-change * Add google auth step * Move GCP code back to prod config * Versioning * Format * Remove unnecessary permissions
1 parent 2484350 commit 493adff

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

changelog_entry.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- bump: patch
2+
changes:
3+
fixed:
4+
- GCP uploads use permissions correctly

policyengine_us_data/storage/upload_completed_datasets.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,14 @@
66
from policyengine_us_data.storage import STORAGE_FOLDER
77
from policyengine_us_data.utils.huggingface import upload
88
from google.cloud import storage
9+
import google.auth
910

1011

1112
def upload_datasets():
12-
storage_client = storage.Client()
13+
credentials, project_id = google.auth.default()
14+
storage_client = storage.Client(
15+
credentials=credentials, project=project_id
16+
)
1317
bucket = storage_client.bucket("policyengine-us-data")
1418

1519
datasets_to_upload = [

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ dependencies = [
2525
"microimpute",
2626
"pip-system-certs",
2727
"google-cloud-storage",
28+
"google-auth",
2829
]
2930

3031
[project.optional-dependencies]

0 commit comments

Comments
 (0)