Skip to content

Commit

Permalink
Add secret-env property to auth object
Browse files Browse the repository at this point in the history
Set secret env in auth method, supports a default value of `VAULT_SECRET_ID`
  • Loading branch information
jeremybumsted committed Sep 20, 2022
1 parent a033607 commit 93c1149
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/shared.bash
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ vault_auth() {
# approle authentication
if [ "${BUILDKITE_PLUGIN_VAULT_SECRETS_AUTH_METHOD:-}" = "approle" ]; then

secret_var="${BUILDKITE_PLUGIN_VAULT_SECRETS_AUTH_SECRET_ENV:-$VAULT_SECRET_ID}"

if [[ -z "${!secret_var:-}" ]]; then
echo "+++ 🚨 No vault secret id found in \$${secret_var}"
exit 1
fi

# export the vault token to be used for this job - this command writes to the auth/approle/login endpoint
# on success, vault will return the token which we export as VAULT_TOKEN for this shell
export VAULT_TOKEN
Expand Down

0 comments on commit 93c1149

Please sign in to comment.