Skip to content

Instantly share code, notes, and snippets.

@lox
Created November 11, 2024 04:37
Show Gist options
  • Save lox/9be38faf57ca0400b63a19070773593e to your computer and use it in GitHub Desktop.
Save lox/9be38faf57ca0400b63a19070773593e to your computer and use it in GitHub Desktop.
Example Buildkite Pipeline to Print OIDC Token
steps:
- label: ":key: Test OIDC Token"
command: |
# Request an OIDC token
echo "--- :buildkite: Requesting OIDC token"
BUILDKITE_OIDC_TOKEN="$(buildkite-agent oidc request-token)"
echo "--- :mag: Token details"
# Print token (redacted in logs for security)
echo "Token: \$BUILDKITE_OIDC_TOKEN"
# Decode and print token payload (base64 decoded)
echo "Decoded payload:"
echo \$BUILDKITE_OIDC_TOKEN | cut -d. -f2 | base64 -d | jq .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment