Update image version in Helm chart to 1.2.12 #3970
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test Helm Chart | |
| on: [push] | |
| env: | |
| SKIP_VALIDATIONS: false | |
| jobs: | |
| # This job lints the chart | |
| helm-chart-lint: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: SETUP - Checkout | |
| uses: actions/checkout@v5 | |
| - name: SETUP - Set up Helm | |
| uses: azure/setup-helm@v5.0.0 | |
| with: | |
| version: v3.14.4 | |
| - name: SETUP - Set up chart-testing | |
| uses: helm/chart-testing-action@v2.8.0 | |
| - name: TEST - Lint the chart | |
| env: | |
| # Agent Chart settings (prom repo is to work around issue with chart-testing tool) | |
| PROM_CHART_REPO: https://prometheus-community.github.io/helm-charts | |
| CZ_CHART_REPO: https://cloudzero.github.io/cloudzero-charts | |
| CZ_CHART_BETA_REPO: https://cloudzero.github.io/cloudzero-charts/beta | |
| CLUSTER_NAME: cz-node-agent-ci | |
| CLOUD_ACCOUNT_ID: "00000000" | |
| CZ_API_TOKEN: "fake-api-token" | |
| REGION: "us-east-1" | |
| run: | | |
| cd helm/ | |
| helm dependency update | |
| ct lint --debug --charts . \ | |
| --chart-repos=kube-state-metrics="$PROM_CHART_REPO" \ | |
| --helm-lint-extra-args "--set=existingSecretName=api-token,clusterName=$CLUSTER_NAME,cloudAccountId=$CLOUD_ACCOUNT_ID,region=$REGION" | |
| # This job runs helm tests using the project's Makefile | |
| helm-test: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: SETUP - Checkout | |
| uses: actions/checkout@v5 | |
| - name: SETUP - Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: go.mod | |
| - name: SETUP - Install tools | |
| run: make install-tools V=1 | |
| - name: Install Checkov | |
| run: | | |
| command -v pip3 || (sudo apt update && sudo apt install python3-pip -y) | |
| pip3 install checkov | |
| - name: TEST - Run helm tests | |
| env: | |
| CLOUDZERO_DEV_API_KEY: "fake-api-key" | |
| run: make -j helm-test V=1 | |
| # This job tests the chart on a KinD cluster | |
| # and if we are in the develop or tag branch, it will | |
| # publish the image to the production registry | |
| helm-chart-install: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| # required to push the image to the registry | |
| packages: write | |
| # required for image signing | |
| id-token: write | |
| steps: | |
| # Checkout the repository code | |
| - name: SETUP - Checkout | |
| id: checkout_code | |
| uses: actions/checkout@v5 | |
| # Install helm on the host | |
| - name: SETUP - Helm | |
| id: install_helm | |
| uses: azure/setup-helm@v5.0.0 | |
| with: | |
| version: v3.14.4 | |
| # Install chart-testing tool to make chart validation easier | |
| - name: SETUP - chart-testing | |
| id: install_ct | |
| uses: helm/chart-testing-action@v2.8.0 | |
| # Create a KinD cluster with a registry pod for testing (kind-registry:5000) | |
| - name: SETUP - Kubernetes KinD Cluster | |
| id: install_kind | |
| uses: helm/kind-action@v1 | |
| # Sanity Check: Validate the k8s and Registry is Running | |
| - name: SANITY CHECK - KinD | |
| id: validate_kind_install | |
| run: | | |
| kubectl version | |
| kubectl cluster-info | |
| kubectl describe nodes | |
| # PRs from a fork don't have access to the secrets | |
| # don't fail in this case, skip validate | |
| - name: INPUT PREP - Skip validation | |
| id: skip_validation | |
| run: | | |
| # Skip if secret is not defined | |
| if [[ -z "${{ secrets.CZ_DEV_API_TOKEN }}" ]]; then | |
| echo "SKIP_VALIDATIONS=true" >>"${GITHUB_ENV}" | |
| fi | |
| # Install the chart using our temporary image | |
| - name: TEST - Install the chart | |
| id: test_chart_installation | |
| if: ${{ env.SKIP_VALIDATIONS == 'false' }} | |
| env: | |
| NAMESPACE: monitoring | |
| # Agent Chart settings (prom repo is to work around issue with chart-testing tool) | |
| PROM_CHART_REPO: https://prometheus-community.github.io/helm-charts | |
| CZ_CHART_REPO: https://cloudzero.github.io/cloudzero-charts | |
| CZ_CHART_BETA_REPO: https://cloudzero.github.io/cloudzero-charts/beta | |
| CLUSTER_NAME: cz-node-agent-ci | |
| CLOUD_ACCOUNT_ID: "00000000" | |
| CZ_API_TOKEN: ${{ secrets.CZ_DEV_API_TOKEN || 'fake-api-token' }} | |
| REGION: "us-east-1" | |
| run: | | |
| kubectl create namespace "$NAMESPACE" | |
| kubectl create secret -n "$NAMESPACE" generic api-token --from-literal=value="$CZ_API_TOKEN" | |
| cd helm/ | |
| helm dependency update | |
| ct install --charts . \ | |
| --chart-repos=kube-state-metrics="$PROM_CHART_REPO" \ | |
| --namespace "$NAMESPACE" \ | |
| --helm-extra-set-args "\ | |
| --set=existingSecretName=api-token \ | |
| --set=host=dev-api.cloudzero.com \ | |
| --set=clusterName=$CLUSTER_NAME \ | |
| --set=cloudAccountId=$CLOUD_ACCOUNT_ID \ | |
| --set=region=$REGION \ | |
| " |