Skip to content

Commit f584e34

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

File tree

3 files changed

+83
-2
lines changed

3 files changed

+83
-2
lines changed

.github/workflows/lint-chart.yaml

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
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+
paths:
17+
- "kwok/charts/**"
18+
pull_request:
19+
paths:
20+
- "kwok/charts/**"
21+
22+
permissions:
23+
contents: read
24+
25+
jobs:
26+
chart-lint-test:
27+
runs-on: ubuntu-22.04
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
31+
with:
32+
fetch-depth: 0
33+
34+
- name: Set up Helm
35+
uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4.2.0
36+
with:
37+
version: ${{ env.HELM_VERSION }}
38+
39+
- name: Run chart-testing (template)
40+
run: |
41+
helm template --dependency-update ./kwok/charts --debug > /dev/null
42+
43+
# Python is required because `ct lint` runs Yamale (https://github.com/23andMe/Yamale) and
44+
# yamllint (https://github.com/adrienverge/yamllint) which require Python
45+
- name: Set up Python
46+
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1
47+
with:
48+
python-version: "3.10"
49+
check-latest: true
50+
51+
- name: Set up chart-testing
52+
uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992
53+
54+
- name: Add dependency chart repos
55+
run: |
56+
helm repo add bitnami https://charts.bitnami.com/bitnami
57+
58+
- name: Run chart-testing (list-changed)
59+
id: list-changed
60+
run: |
61+
changed=$( ct list-changed )
62+
if [[ -n "$changed" ]]; then
63+
echo "changed=true" >> $GITHUB_OUTPUT
64+
fi
65+
66+
- name: Run chart-testing (lint)
67+
if: steps.list-changed.outputs.changed == 'true'
68+
run: ct lint --debug --check-version-increment=false
69+
70+
- name: Create kind cluster
71+
uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0
72+
if: steps.list-changed.outputs.changed == 'true'
73+
with:
74+
wait: 120s
75+
version: ${{ env.KIND_VERSION }}
76+
node_image: ${{ env.KIND_NODE_IMAGE }}
77+
kubectl_version: ${{ env.K8S_VERSION }}
78+
79+
- name: Run chart-testing (install)
80+
if: steps.list-changed.outputs.changed == 'true'
81+
run: ct install --debug --helm-extra-args "--timeout 800s"

kwok/charts/templates/role.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,4 @@ rules:
7575
# Write
7676
- apiGroups: ["coordination.k8s.io"]
7777
resources: ["leases"]
78-
verbs: ["delete"]
78+
verbs: ["delete"]

kwok/charts/templates/secret-webhook-cert.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ metadata:
1111
{{- toYaml . | nindent 4 }}
1212
{{- end }}
1313
# data: {} # Injected by karpenter-webhook
14-
{{- end }}
14+
{{- end }}

0 commit comments

Comments
 (0)