Skip to content

Commit a56e2c5

Browse files
Merge pull request #1408 from getsentry/test-me-gha-workload-identity
fix: switch github actions to workload identity, take 2
2 parents 3fa9d33 + 4a3a092 commit a56e2c5

File tree

3 files changed

+23
-14
lines changed

3 files changed

+23
-14
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ jobs:
5454
needs: [linux, macos]
5555
if: github.event_name != 'pull_request'
5656
runs-on: ubuntu-latest
57+
permissions:
58+
id-token: write
59+
contents: read
5760
steps:
5861
- uses: actions/checkout@v3
5962
- uses: actions/setup-python@v4
@@ -64,8 +67,8 @@ jobs:
6467
with:
6568
path: dist
6669
- run: python3 -um make_index --pypi-url https://pypi.devinfra.sentry.io --dest index
67-
- uses: google-github-actions/auth@v0
70+
- uses: google-github-actions/auth@ba79af03959ebeac9769e648f473a284504d9193 # v2.1.10
6871
with:
69-
credentials_json: ${{ secrets.PYPI_DEVINFRA_SENTRY_IO }}
70-
- run: yes | gcloud auth login --cred-file="$GOOGLE_APPLICATION_CREDENTIALS"
72+
workload_identity_provider: projects/868781662168/locations/global/workloadIdentityPools/prod-github/providers/github-oidc-pool
73+
service_account: [email protected]
7174
- run: python3 -uS bin/upload-artifacts

bin/upload-artifacts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import os.path
66
import shlex
77
import subprocess
88

9-
CACHE_ONE_HOUR = ("-h", "Cache-Control: public, max-age=3600") # gcs default
10-
CACHE_FIVE_MINUTES = ("-h", "Cache-Control: public, max-age=300")
11-
CACHE_NO = ("-h", "Cache-Control: no-store")
9+
CACHE_ONE_HOUR = ("--cache-control", "public, max-age=3600") # gcs default
10+
CACHE_FIVE_MINUTES = ("--cache-control", "public, max-age=300")
11+
CACHE_NO = ("--cache-control", "no-store")
1212

1313

1414
def main() -> int:
@@ -24,20 +24,20 @@ def main() -> int:
2424
cmds = (
2525
# upload wheels first before the index
2626
(
27-
"gsutil",
28-
*CACHE_ONE_HOUR, # these are immutable so cache at default
29-
"-m", # parallel
27+
"gcloud",
28+
"storage",
3029
"cp",
3130
"-n", # no-clobber
31+
*CACHE_ONE_HOUR, # these are immutable so cache at default
3232
os.path.join(args.index, "wheels", "*"),
3333
"gs://pypi.devinfra.sentry.io/wheels/",
3434
),
3535
# upload the site parts in clobber mode (may be updating pages)
3636
(
37-
"gsutil",
38-
*CACHE_FIVE_MINUTES, # shorter than default to make pip snappier
39-
"-m", # parallel
37+
"gcloud",
38+
"storage",
4039
"cp",
40+
*CACHE_FIVE_MINUTES, # shorter than default to make pip snappier
4141
"-r", # recursive
4242
*(
4343
os.path.join(args.index, name)
@@ -47,10 +47,11 @@ def main() -> int:
4747
"gs://pypi.devinfra.sentry.io",
4848
),
4949
(
50-
"gsutil",
50+
"gcloud",
51+
"storage",
52+
"cp",
5153
# the packages.json file must be consistently read so no caching
5254
*CACHE_NO,
53-
"cp",
5455
os.path.join(args.index, "packages.json"),
5556
"gs://pypi.devinfra.sentry.io",
5657
),

packages.ini

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ validate_extras = d
100100
validate_extras = d
101101
[black==24.10.0]
102102
validate_extras = d
103+
[black==25.1.0]
104+
validate_extras = d
103105

104106
[blinker==1.4]
105107
[blinker==1.5]
@@ -1016,6 +1018,7 @@ python_versions = <3.13
10161018

10171019
[mypy-extensions==0.4.3]
10181020
[mypy-extensions==1.0.0]
1021+
[mypy-extensions==1.1.0]
10191022

10201023
[myst-parser==0.18.0]
10211024

@@ -1078,6 +1081,7 @@ python_versions = <3.13
10781081
[packaging==24.0]
10791082
[packaging==24.1]
10801083
[packaging==24.2]
1084+
[packaging==25.0]
10811085

10821086
[paramiko==2.11.0]
10831087
[paramiko==3.4.0]
@@ -1169,6 +1173,7 @@ python_versions = <3.13
11691173
[platformdirs==4.2.0]
11701174
[platformdirs==4.2.2]
11711175
[platformdirs==4.3.6]
1176+
[platformdirs==4.3.7]
11721177

11731178
[pluggy==0.13.1]
11741179
[pluggy==1.0.0]

0 commit comments

Comments
 (0)