Skip to content

update vault

update vault #17

Workflow file for this run

name: Token Auth2
on: push
permissions:
id-token: write
contents: read
jobs:
read-secret:
runs-on: ubuntu-latest
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout
uses: actions/checkout@v2
# Shout out to Benjamin Pannell at Sierra Softworks for this
# https://sierrasoftworks.com/2021/12/20/vault-github-actions/#policies
- name: Retrieve Secrets
id: secretdata
uses: hashicorp/[email protected]
with:
url: ${{ secrets.VAULT_ADDR }}
namespace: ${{ secrets.VAULT_NAMESPACE }}
token: ${{ secrets.VAULT_TOKEN }}
secrets: ${{ secrets.VAULT_SECRET_PATH }} ${{ secrets.VAULT_SECRET_KEY }} | MY_SECRET
- name: Print Secrets
run: |
echo '${{ steps.secretdata.outputs.MY_SECRET }}'
- name: Build Docker Image
run: docker build . --file Dockerfile --build-arg app_secret="${{ env.MY_SECRET }}" -t vault-action-exampleapp
- name: read secret from container
run: docker run vault-action-exampleapp /bin/bash -c "cat ./app_secret" | sed 's/./& /g'