Skip to content

Instantly share code, notes, and snippets.

@Kasama
Created March 30, 2020 21:33
Show Gist options
  • Save Kasama/c491cdc373f37fb1a9ee9e5be8cffb62 to your computer and use it in GitHub Desktop.
Save Kasama/c491cdc373f37fb1a9ee9e5be8cffb62 to your computer and use it in GitHub Desktop.
cache:
key: "$CI_PIPELINE_ID"
paths:
- ./variables.env
vault:
stage: vault
image: vault:latest
script:
- export VAULT_TOKEN=$(vault write -field=token auth/approle/login role_id=${VAULT_ROLE_ID} secret_id=${VAULT_SECRET_ID})
- vault kv get -field=ACCESS_KEY_ID services/gitlab/production/sa-east-1/gitlab-runner-user-access-key | awk '{print "export AWS_ACCESS_KEY_ID="$1}' >> variables.env
- vault kv get -field=ACCESS_KEY_SECRET services/gitlab/production/sa-east-1/gitlab-runner-user-access-key | awk '{print "export AWS_SECRET_ACCESS_KEY="$1}' >> variables.env
- vault kv get -field=GITLAB_ACCESS_TOKEN services/gitlab/production/sa-east-1/gitlab-bot-access-token | awk '{print "export GITLAB_ACCESS_TOKEN="$1}' >> variables.env
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment