Skip to content

Commit

Permalink
Merge pull request #6 from infralovers/hashicorp-vault-secrets
Browse files Browse the repository at this point in the history
feat: hcp vault secrets sync
  • Loading branch information
mabunixda authored Jan 12, 2024
2 parents 8caaf7b + 4ad56f6 commit 252a9ca
Showing 1 changed file with 27 additions and 16 deletions.
43 changes: 27 additions & 16 deletions workflow-templates/container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,24 @@ on:
pull_request:
branches: [ $default-branch ]

env:
platforms: linux/amd64, linux/arm64
DOCKERHUB_USER: "${{ fromJSON(secrets.VAULT_KV_1D187965_OP_DOCKERHUB_INFRA_MACHINE).username }}"
DOCKERHUB_TOKEN: "${{ fromJSON(secrets.VAULT_KV_1D187965_OP_DOCKERHUB_INFRA_MACHINE).token }}"

QUAY_USER: "${{ fromJSON(secrets.VAULT_KV_1D187965_OP_QUAY_ROBOT_ACCOUNT).username }}"
QUAY_TOKEN: "${{ fromJSON(secrets.VAULT_KV_1D187965_OP_QUAY_ROBOT_ACCOUNT).password }}"

BOT_ACCESS_TOKEN: "${{ fromJSON(secrets.VAULT_KV_1D187965_OP_GITHUB_INFRALOVERS).PAT }}"


jobs:
prebuild:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.semrel.outputs.version }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Check pre-commit presence
id: precommit_exists
Expand All @@ -23,7 +34,7 @@ jobs:
- uses: actions/setup-python@v3
if: steps.precommit_exists.outputs.files_exists == 'true'

- uses: pre-commit/action@v3.0.0
- uses: pre-commit/action@v3
if: steps.precommit_exists.outputs.files_exists == 'true'

- uses: go-semantic-release/action@v1
Expand All @@ -38,7 +49,7 @@ jobs:
runs-on: ubuntu-latest
needs: [ prebuild ]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Prepare tagging
id: prep
Expand Down Expand Up @@ -69,12 +80,12 @@ jobs:
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3
with:
platforms: 'arm64,amd64'
platforms: ${{ env.platforms }}

- name: Cache Docker layers
uses: actions/cache@v2
Expand All @@ -86,36 +97,36 @@ jobs:
- name: Login to DockerHub
if: needs.prebuild.outputs.version != ''
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
username: ${{ env.DOCKERHUB_USER }}
password: ${{ env.DOCKERHUB_TOKEN }}

- name: Login to Quay
if: needs.prebuild.outputs.version != ''
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USER }}
password: ${{ secrets.QUAY_TOKEN }}
username: ${{ env.QUAY_USER }}
password: ${{ env.QUAY_TOKEN }}

- name: Login to GitHub Container Registry
if: needs.prebuild.outputs.version != ''
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.BOT_ACCESS_TOKEN }}
password: ${{ env.BOT_ACCESS_TOKEN }}

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
file: ./Dockerfile
push: ${{ github.event_name != 'pull_request' && needs.prebuild.outputs.version != '' }}
tags: ${{ steps.prep.outputs.tags }}
platforms: ${{ env.platforms }}

release:
needs: [ prebuild, build ]
Expand Down

0 comments on commit 252a9ca

Please sign in to comment.