helm / chart-testing-action

A GitHub Action to lint and test Helm charts
https://github.com/helm/chart-testing
Apache License 2.0
251 stars 71 forks source link

Setting up a imagePullSecrets for a private github repo to fetch the Docker image #130

Closed MTRNord closed 1 year ago

MTRNord commented 1 year ago

Hi,

I am trying to use this in a private github repository. The Docker image is on the github registry. Obviously, that means I require a imagePullSecrets. However I dont get how to do that.

I tried multiple things but since there is a dynamically generated namespace I cant predict that one. Is there another way?

cpanato commented 1 year ago

hello @MTRNord fetch what image? I did not understand your question, can you please clarify?

MTRNord commented 1 year ago

Hi this since has been solved and sorry for the late update. The end solution were these steps:

      # Needed for us to log in to github since the repo is private
      - env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          USERNAME: ${{ github.actor }}
        run: |
          kubectl create namespace tim
          kubectl create secret docker-registry testing --docker-server=https://ghcr.io --docker-username="$USERNAME" --docker-password="$GITHUB_TOKEN" --namespace=testing
      - name: Run chart-testing (install)
        if: steps.list-changed.outputs.changed == 'true'
        run: ct install --config=".github/k8s_config.yaml" --target-branch ${{ github.event.repository.default_branch }} --helm-extra-set-args="--set=imagePullSecrets[0].name=testing"

where k8s_config.yaml looks like this:

namespace: "testing"
release-label: "app.kubernetes.io/instance"