Skip to content

Commit 292af8e

Browse files
authored
Agent token (#245)
1 parent 7b0bfe7 commit 292af8e

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,4 @@ credentials.json
3636

3737
# Ignore generated credentials from google-github-actions/auth
3838
gha-creds-*.json
39+
key.json

scripts/generate_agent_token.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
11
#!/bin/bash
22

3+
SERVICE_ACCOUNT=$CAPY_SERVICE_ACCOUNT
4+
PROJECT_ID=$CAPY_PROJECT_ID
5+
6+
gcloud iam service-accounts add-iam-policy-binding $SERVICE_ACCOUNT \
7+
--role=roles/iam.serviceAccountTokenCreator \
8+
--member=serviceAccount:$SERVICE_ACCOUNT \
9+
--project=$PROJECT_ID
10+
11+
gcloud iam service-accounts keys create key.json \
12+
--iam-account=$SERVICE_ACCOUNT
13+
14+
# Activate the service account
15+
gcloud auth activate-service-account --key-file=key.json
16+
17+
# Generate the identity token
318
gcloud auth print-identity-token

0 commit comments

Comments
 (0)