-
Notifications
You must be signed in to change notification settings - Fork 5
183 lines (152 loc) · 4.92 KB
/
helm-chart-ci.yml
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
name: Helm Chart CI
on:
workflow_dispatch:
push:
paths:
- 'charts/**'
- '.github/workflows/helm-chart-ci.yml'
- '.github/*.sh'
- '.github/tests/**/*.yaml'
- '.github/kind/conf/kind-config.yaml'
branches-ignore:
- main
pull_request:
paths:
- 'charts/**'
- '.github/workflows/helm-chart-ci.yml'
- '.github/*.sh'
- '.github/tests/**/*.yaml'
- '.github/kind/conf/kind-config.yaml'
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
env:
HELM_VERSION: v3.10.3
PYTHON_VERSION: 3.11.1
CHART_TESTING_VERSION: v3.7.1
jobs:
check-docs:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/[email protected]
- name: Verify Docs updated
run: .github/helm-docs.sh
lint-chart:
runs-on: ubuntu-22.04
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@v4
with:
version: ${{ env.HELM_VERSION }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Setup chart-testing
uses: helm/[email protected]
with:
version: ${{ env.CHART_TESTING_VERSION }}
- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --target-branch main)
if [[ -n "$changed" ]]; then
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Setup chartmuseum
if: ${{ steps.list-changed.outputs.changed }}
uses: marcofranssen/[email protected]
with:
bootup: true
- name: Setup charts repo localhost
if: ${{ steps.list-changed.outputs.changed }}
run: .github/local-helm-repo.sh
- name: Run chart-testing (lint)
run: |
ct lint --debug \
--target-branch main \
--chart-repos philips-labs=http://127.0.0.1:8879
outputs:
changed: ${{ steps.list-changed.outputs.changed }}
build-matrix:
name: Build matrix
runs-on: ubuntu-22.04
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
steps:
- name: Checkout
uses: actions/[email protected]
- id: set-matrix
run: |
tests="$(echo -e "default\n$(find .github/tests -maxdepth 1 -type d | grep -Ev 'tests$' | xargs -I % basename % | sort | uniq)")"
tests_json="$(echo "$tests" | jq -c --slurp --raw-input 'split("\n") | map(select(. != ""))')"
echo "tests=$tests_json" >> $GITHUB_OUTPUT
outputs:
tests: ${{ steps.set-matrix.outputs.tests }}
test:
name: Test
runs-on: ubuntu-22.04
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
needs:
- lint-chart
- build-matrix
strategy:
fail-fast: false
matrix:
k8s:
- v1.21.14
- v1.22.15
- v1.23.13
- v1.24.7
- v1.25.3
values:
- ${{ fromJson(needs.build-matrix.outputs.tests) }}
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@v4
with:
version: ${{ env.HELM_VERSION }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Setup chart-testing
uses: helm/[email protected]
with:
version: ${{ env.CHART_TESTING_VERSION }}
- name: Setup chartmuseum
if: ${{ needs.lint-chart.outputs.changed }}
uses: marcofranssen/[email protected]
with:
bootup: true
- name: Setup charts repo localhost
if: ${{ needs.lint-chart.outputs.changed }}
run: .github/local-helm-repo.sh
- name: Create kind ${{ matrix.k8s }} cluster
uses: helm/[email protected]
# Only build a kind cluster if there are chart changes to test.
if: needs.lint-chart.outputs.changed == 'true'
with:
version: v0.16.0
node_image: kindest/node:${{ matrix.k8s }}
config: .github/kind/conf/kind-config.yaml
verbosity: 1
- name: Run chart-testing (install)
run: |
ct install --debug \
--target-branch main \
--chart-repos philips-labs=http://127.0.0.1:8879 \
--excluded-charts spire-client-example \
--exclude-deprecated \
${{ (matrix.values != 'default' && '--helm-extra-set-args "--values=.github/tests/$VALUES/values.yaml"') || '' }}
env:
VALUES: ${{ matrix.values }}