Skip to content

Instantly share code, notes, and snippets.

@feroult
Created February 5, 2021 14:56
Show Gist options
  • Save feroult/b8c88fe38ddea4c2637725cc6ae82a15 to your computer and use it in GitHub Desktop.
Save feroult/b8c88fe38ddea4c2637725cc6ae82a15 to your computer and use it in GitHub Desktop.
Id Token Google Cloud Build
- name: gcr.io/cloud-builders/gcloud
entrypoint: "bash"
args:
- "-c"
- |
apt update && apt install jq -y
curl -X POST -H "content-type: application/json" \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-d '{"audience": "dexinapp"}' \
"https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/___SERVICE_ACCOUNT_EMAIL___:generateIdToken" | jq -r .token > /workspace/token.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment