From 19c104f2c868b5a9b786b9e2da827b7b51b10b1f Mon Sep 17 00:00:00 2001 From: Timo Behrendt Date: Sun, 25 Jan 2026 17:18:05 +0100 Subject: [PATCH] feat-add-docker-registry-token (#41) Co-authored-by: Renovate Bot Reviewed-on: https://gitea.t000-n.de/t.behrendt/k/pulls/41 Co-authored-by: Timo Behrendt Co-committed-by: Timo Behrendt --- .gitea/workflows/deploy.yaml | 30 ++++++++++++++++++++++++++---- .gitea/workflows/validate.yaml | 5 ++--- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml index b0b39b0..7a6a80e 100644 --- a/.gitea/workflows/deploy.yaml +++ b/.gitea/workflows/deploy.yaml @@ -15,7 +15,7 @@ jobs: traefik: ${{ steps.filter.outputs.traefik }} crowdsec: ${{ steps.filter.outputs.crowdsec }} steps: - - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 with: fetch-depth: 0 - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3 @@ -36,7 +36,7 @@ jobs: needs: check-changes if: ${{ needs.check-changes.outputs.node-labels == 'true' || github.event_name == 'workflow_dispatch' }} steps: - - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 - uses: azure/setup-kubectl@776406bce94f63e41d621b960d78ee25c8b76ede # v4 - uses: azure/k8s-set-context@ae59a723ba9abe7a9655538854a025448dbab4aa # v4 with: @@ -51,7 +51,7 @@ jobs: needs: check-changes if: ${{ needs.check-changes.outputs.coredns == 'true' || github.event_name == 'workflow_dispatch' }} steps: - - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 - uses: azure/setup-kubectl@776406bce94f63e41d621b960d78ee25c8b76ede # v4 - uses: azure/k8s-set-context@ae59a723ba9abe7a9655538854a025448dbab4aa # v4 with: @@ -135,5 +135,27 @@ jobs: uses: helmfile/helmfile-action@f64d5db9f8660aae0205b5fcfc56577d44acefab # v2.1.0 with: helmfile-args: apply - helm-plugins: https://github.com/databus23/helm-diff@v3.12.0 helmfile-workdirectory: "crowdsec" + + deploy-docker-registry-secret: + runs-on: ubuntu-latest + needs: check-changes + steps: + - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 + - uses: azure/setup-kubectl@776406bce94f63e41d621b960d78ee25c8b76ede # v4 + - uses: azure/k8s-set-context@ae59a723ba9abe7a9655538854a025448dbab4aa # v4 + with: + method: kubeconfig + kubeconfig: ${{ secrets.KUBECONFIG }} + - name: Set docker registry credentials + run: | + kubectl create secret docker-registry regcred-dockerhub \ + --docker-server=https://index.docker.io/v1/ \ + --docker-username="${{ secrets.DOCKER_USERNAME }}" \ + --docker-password="${{ secrets.DOCKER_PASSWORD }}" \ + --docker-email="${{ secrets.DOCKER_EMAIL }}" \ + --namespace=default \ + --dry-run=client -o yaml | kubectl apply -f - + - name: Configure image pull secret globally + run: | + kubectl patch serviceaccount default -p '{"imagePullSecrets": [{"name": "regcred-dockerhub"}]}' diff --git a/.gitea/workflows/validate.yaml b/.gitea/workflows/validate.yaml index 596a9d1..6e09672 100644 --- a/.gitea/workflows/validate.yaml +++ b/.gitea/workflows/validate.yaml @@ -9,7 +9,7 @@ jobs: validate-node-lables: runs-on: ubuntu-latest steps: - - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 - uses: azure/setup-kubectl@776406bce94f63e41d621b960d78ee25c8b76ede # v4 - uses: azure/k8s-set-context@ae59a723ba9abe7a9655538854a025448dbab4aa # v4 with: @@ -22,7 +22,7 @@ jobs: validate-coredns: runs-on: ubuntu-latest steps: - - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 - uses: azure/setup-kubectl@776406bce94f63e41d621b960d78ee25c8b76ede # v4 - uses: azure/k8s-set-context@ae59a723ba9abe7a9655538854a025448dbab4aa # v4 with: @@ -66,5 +66,4 @@ jobs: uses: helmfile/helmfile-action@f64d5db9f8660aae0205b5fcfc56577d44acefab # v2.1.0 with: helmfile-args: diff - helm-plugins: https://github.com/databus23/helm-diff@v3.12.0 helmfile-workdirectory: "crowdsec"