Skip to content

Commit 46af3e1

Browse files
committed
ci: add lint ci for helm chart.
Signed-off-by: Lan Liang <[email protected]>
1 parent dd09b2d commit 46af3e1

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed

.github/workflows/lint-chart.yaml

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# validate any chart changes under charts directory
2+
name: Chart Lint
3+
4+
env:
5+
HELM_VERSION: v3.11.2
6+
KIND_VERSION: v0.23.0
7+
KIND_NODE_IMAGE: kindest/node:v1.30.0
8+
K8S_VERSION: v1.30.0
9+
10+
on:
11+
push:
12+
# Exclude branches created by Dependabot to avoid triggering current workflow
13+
# for PRs initiated by Dependabot.
14+
branches-ignore:
15+
- 'dependabot/**'
16+
pull_request:
17+
paths:
18+
- "charts/**"
19+
20+
permissions:
21+
contents: read
22+
23+
jobs:
24+
chart-lint-test:
25+
runs-on: ubuntu-22.04
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v4
29+
with:
30+
fetch-depth: 0
31+
32+
- name: Set up Helm
33+
uses: azure/setup-helm@v4
34+
with:
35+
version: ${{ env.HELM_VERSION }}
36+
37+
- name: Run chart-testing (template)
38+
run: |
39+
helm template --dependency-update ./kwok/charts --debug > /dev/null
40+
41+
# Python is required because `ct lint` runs Yamale (https://github.com/23andMe/Yamale) and
42+
# yamllint (https://github.com/adrienverge/yamllint) which require Python
43+
- name: Set up Python
44+
uses: actions/setup-python@v5
45+
with:
46+
python-version: 3.9
47+
check-latest: true
48+
49+
- name: Set up chart-testing
50+
uses: helm/[email protected]
51+
52+
- name: Add dependency chart repos
53+
run: |
54+
helm repo add bitnami https://charts.bitnami.com/bitnami
55+
56+
- name: Run chart-testing (list-changed)
57+
id: list-changed
58+
run: |
59+
changed=$( ct list-changed )
60+
if [[ -n "$changed" ]]; then
61+
echo "changed=true" >> $GITHUB_OUTPUT
62+
fi
63+
64+
- name: Run chart-testing (lint)
65+
if: steps.list-changed.outputs.changed == 'true'
66+
run: ct lint --debug --check-version-increment=false
67+
68+
- name: Create kind cluster
69+
uses: helm/[email protected]
70+
if: steps.list-changed.outputs.changed == 'true'
71+
with:
72+
wait: 120s
73+
version: ${{ env.KIND_VERSION }}
74+
node_image: ${{ env.KIND_NODE_IMAGE }}
75+
kubectl_version: ${{ env.K8S_VERSION }}
76+
77+
- name: Run chart-testing (install)
78+
if: steps.list-changed.outputs.changed == 'true'
79+
run: ct install --debug --helm-extra-args "--timeout 800s"

0 commit comments

Comments
 (0)