-
Notifications
You must be signed in to change notification settings - Fork 888
113 lines (94 loc) · 3.6 KB
/
lint-chart.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# validate any chart changes under charts directory
name: Chart Lint
env:
HELM_VERSION: v3.11.2
KUSTOMIZE_VERSION: 5.4.3
KIND_VERSION: v0.22.0
KIND_NODE_IMAGE: kindest/node:v1.29.0
K8S_VERSION: v1.29.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: install Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Set up Helm
uses: azure/setup-helm@v4
with:
version: ${{ env.HELM_VERSION }}
- name: Set up Kustomize
uses: syntaqx/setup-kustomize@v1
with:
kustomize-version: ${{ env.KUSTOMIZE_VERSION }}
- name: Run chart-testing (template)
run: |
cat <<EOF > post-render.sh
#!/bin/sh
# save helm stdout to file, kustomize will read this
cat > all.yaml
kustomize build
EOF
chmod +x post-render.sh
cat <<EOF > kustomization.yaml
resources:
- all.yaml
EOF
helm template --set components={"search,descheduler,schedulerEstimator"} --dependency-update ./charts/karmada \
--post-renderer ./post-render.sh --debug > /dev/null
helm template --set components={"search,descheduler,schedulerEstimator"},certs.mode=custom --dependency-update \
./charts/karmada --post-renderer ./post-render.sh --debug > /dev/null
helm template --set components={"search,descheduler,schedulerEstimator"},installMode=component --dependency-update \
./charts/karmada --post-renderer ./post-render.sh --debug > /dev/null
helm template --set installMode=agent --dependency-update ./charts/karmada --post-renderer ./post-render.sh --debug > /dev/null
helm template --dependency-update ./charts/karmada-operator --post-renderer ./post-render.sh --debug > /dev/null
rm post-render.sh all.yaml kustomization.yaml
# 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
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
- name: Run chart-testing (list-changed)
id: list-changed
run: |
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)
if: steps.list-changed.outputs.changed == 'true'
run: ct install --debug --helm-extra-args "--timeout 800s"