From 9201d5924ba6b342d3d0811c088c12ce6d04528e Mon Sep 17 00:00:00 2001 From: Kai Reichart Date: Thu, 28 Nov 2024 10:10:06 +0100 Subject: [PATCH] added secrets --- .github/workflows/build-docker-test.yml | 3 +++ .github/workflows/build-docker.yml | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/.github/workflows/build-docker-test.yml b/.github/workflows/build-docker-test.yml index 1e4435f..ac12e68 100644 --- a/.github/workflows/build-docker-test.yml +++ b/.github/workflows/build-docker-test.yml @@ -4,3 +4,6 @@ jobs: uses: ./.github/workflows/build-docker.yml with: tag: 'forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/devfw-cicd/build/test:latest' + registry: 'forgejo.edf-bootstrap.cx.fg1.ffm.osc.live' + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_PASSWORD }} diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index fbc4387..6d0dd8e 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -17,6 +17,18 @@ on: description: 'The tag to apply to the built image' required: true type: string + registry: + description: 'The registry to push the image to' + required: true + type: string + username: + description: 'The username to authenticate with the registry' + required: true + type: string + password: + description: 'The password to authenticate with the registry' + required: true + type: string jobs: build-go: @@ -26,6 +38,13 @@ jobs: steps: - name: Clone Repository uses: https://forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/DevFW-CICD/checkout@main + + - name: Build Credentials File + run: | + mkdir -p /kaniko/.docker + AUTHSTRING=$(echo -n "${{ inputs.username }}:${{ inputs.password }}" | base64) + echo "{\"auths\":{\"${{ inputs.registry }}\":{\"auth\":\"${AUTHSTRING}\"}}}" > /kaniko/.docker/config.json + - name: Build Docker Container run: | /kaniko/executor --dockerfile=${{ inputs.dockerfile }} --context=${{ inputs.context }} --destination=${{ inputs.tag }}