Skip to content

Commit

Permalink
update vault
Browse files Browse the repository at this point in the history
  • Loading branch information
Kalam Abdul authored and Kalam Abdul committed Nov 20, 2024
1 parent 3392fe5 commit b0ba486
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/token.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Token Auth

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: ${{ secrets.VAULT_TOKEN }}
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'

0 comments on commit b0ba486

Please sign in to comment.