Skip to content

Commit

Permalink
ci: add lint ci for helm chart.
Browse files Browse the repository at this point in the history
Signed-off-by: Lan Liang <gcslyp@gmail.com>
  • Loading branch information
liangyuanpeng committed Aug 7, 2024
1 parent dd09b2d commit 46af3e1
Showing 1 changed file with 79 additions and 0 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/lint-chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# validate any chart changes under charts directory
name: Chart Lint

env:
HELM_VERSION: v3.11.2
KIND_VERSION: v0.23.0
KIND_NODE_IMAGE: kindest/node:v1.30.0
K8S_VERSION: v1.30.0

on:
push:
# Exclude branches created by Dependabot to avoid triggering current workflow
# for PRs initiated by Dependabot.
branches-ignore:
- 'dependabot/**'
pull_request:
paths:
- "charts/**"

permissions:
contents: read

jobs:
chart-lint-test:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@v4
with:
version: ${{ env.HELM_VERSION }}

- name: Run chart-testing (template)

Check failure

Code scanning / CodeQL

Unpinned tag for 3rd party Action in workflow Critical Experimental

Unpinned 3rd party Action 'Chart Lint' step
name: Set up Helm
uses 'azure/setup-helm' with ref 'v4', not a pinned commit hash
run: |
helm template --dependency-update ./kwok/charts --debug > /dev/null
# Python is required because `ct lint` runs Yamale (https://github.com/23andMe/Yamale) and
# yamllint (https://github.com/adrienverge/yamllint) which require Python
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.9
check-latest: true

- name: Set up chart-testing
uses: helm/chart-testing-action@v2.6.1

- name: Add dependency chart repos

Check failure

Code scanning / CodeQL

Unpinned tag for 3rd party Action in workflow Critical Experimental

Unpinned 3rd party Action 'Chart Lint' step
name: S ... testing
uses 'helm/chart-testing-action' with ref 'v2.6.1', not a pinned commit hash
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
- name: Run chart-testing (list-changed)
id: list-changed
run: |

Check failure on line 58 in .github/workflows/lint-chart.yaml

View workflow job for this annotation

GitHub Actions / presubmit (1.25.x)

shellcheck reported issue in this script: SC2086:info:3:26: Double quote to prevent globbing and word splitting

Check failure on line 58 in .github/workflows/lint-chart.yaml

View workflow job for this annotation

GitHub Actions / presubmit (1.26.x)

shellcheck reported issue in this script: SC2086:info:3:26: Double quote to prevent globbing and word splitting

Check failure on line 58 in .github/workflows/lint-chart.yaml

View workflow job for this annotation

GitHub Actions / presubmit (1.27.x)

shellcheck reported issue in this script: SC2086:info:3:26: Double quote to prevent globbing and word splitting

Check failure on line 58 in .github/workflows/lint-chart.yaml

View workflow job for this annotation

GitHub Actions / presubmit (1.28.x)

shellcheck reported issue in this script: SC2086:info:3:26: Double quote to prevent globbing and word splitting

Check failure on line 58 in .github/workflows/lint-chart.yaml

View workflow job for this annotation

GitHub Actions / presubmit (1.29.x)

shellcheck reported issue in this script: SC2086:info:3:26: Double quote to prevent globbing and word splitting

Check failure on line 58 in .github/workflows/lint-chart.yaml

View workflow job for this annotation

GitHub Actions / presubmit (1.30.x)

shellcheck reported issue in this script: SC2086:info:3:26: Double quote to prevent globbing and word splitting
changed=$( ct list-changed )
if [[ -n "$changed" ]]; then
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Run chart-testing (lint)
if: steps.list-changed.outputs.changed == 'true'
run: ct lint --debug --check-version-increment=false

- name: Create kind cluster
uses: helm/kind-action@v1.10.0
if: steps.list-changed.outputs.changed == 'true'
with:
wait: 120s
version: ${{ env.KIND_VERSION }}
node_image: ${{ env.KIND_NODE_IMAGE }}
kubectl_version: ${{ env.K8S_VERSION }}

- name: Run chart-testing (install)

Check failure

Code scanning / CodeQL

Unpinned tag for 3rd party Action in workflow Critical Experimental

Unpinned 3rd party Action 'Chart Lint' step
name: C ... cluster
uses 'helm/kind-action' with ref 'v1.10.0', not a pinned commit hash
if: steps.list-changed.outputs.changed == 'true'
run: ct install --debug --helm-extra-args "--timeout 800s"

0 comments on commit 46af3e1

Please sign in to comment.