-
Notifications
You must be signed in to change notification settings - Fork 28
252 lines (215 loc) · 8.03 KB
/
chart-test.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
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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
name: Lint and Test Charts
on:
push:
branches:
- main
pull_request:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/[email protected]
with:
version: v3.6.3
- name: Add rstudio helm repo
run: helm repo add rstudio https://helm.rstudio.com
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Set up chart-testing
uses: helm/[email protected]
- name: Symlink ci-lint -> ci
run: |
for dir in ci/*/lint; do
dir=${dir#ci/}
dir=${dir%/lint}
ln -s ../../ci/${dir}/lint charts/${dir}/ci
done
- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --target-branch main --chart-dirs charts --chart-dirs other-charts)
if [[ -n "$changed" ]]; then
echo 'changed=true' >> $GITHUB_OUTPUT
fi
- name: Run chart-testing (lint changed)
id: ct-lint
if: steps.list-changed.outputs.changed == 'true'
run: ct lint --target-branch main --chart-dirs charts --chart-dirs other-charts
continue-on-error: true
- name: Run chart-testing (lint all)
id: ct-lint-all
run: ct lint --target-branch main --all --chart-dirs charts --chart-dirs other-charts
continue-on-error: true
- name: Notify Slack of chart linting failure
if: steps.ct-lint.outcome == 'failure' || steps.ct-lint-all.outcome == 'failure'
uses: slackapi/[email protected]
with:
payload-delimiter: "_"
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Linting failed for ${{ steps.ct-lint.outcome == 'failure' && 'changed' || 'all' }} charts. ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
- name: Fail the workflow if failed linting
if: steps.ct-lint.outcome == 'failure' || steps.ct-lint-all.outcome == 'failure'
run: exit 1
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/[email protected]
with:
version: v3.6.3
- name: Install helm unittest plugin
run: helm plugin install --version v0.6.3 https://github.com/helm-unittest/helm-unittest.git
- name: Run chart unit tests
id: unittest
run: |
for dir in $(ls -d charts/*/); do
pushd $dir; helm dependencies update; popd
helm unittest $dir
done
continue-on-error: true
- name: Notify Slack of chart unittest failure
if: steps.unittest.outcome == 'failure'
uses: slackapi/[email protected]
with:
payload-delimiter: "_"
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Chart unit tests failed. ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
- name: Fail the workflow if failed unittest
if: steps.unittest.outcome == 'failure'
run: exit 1
install:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/[email protected]
with:
version: v3.6.3
- name: Add rstudio helm repo
run: helm repo add rstudio https://helm.rstudio.com
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Set up chart-testing
uses: helm/[email protected]
- name: Symlink ci-install -> ci
run: |
for dir in ci/*/install; do
dir=${dir#ci/}
dir=${dir%/install}
ln -s ../../ci/${dir}/install charts/${dir}/ci
done
- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --target-branch main --chart-dirs charts --chart-dirs other-charts)
if [[ -n "$changed" ]]; then
echo 'changed=true' >> $GITHUB_OUTPUT
fi
- name: Create kind cluster
uses: helm/[email protected]
- name: Install SealedSecrets Helm Chart
run: |
helm repo add sealed-secrets https://bitnami-labs.github.io/sealed-secrets
helm install sealed-secrets sealed-secrets/sealed-secrets
- name: Create posit-test namespace
run: kubectl create namespace posit-test
- name: Create License File Secrets
run: |
echo "${{ secrets.PWB_LICENSE_FILE }}" > pwb.lic
kubectl create secret generic pwb-license --from-file=pwb.lic --namespace posit-test
rm pwb.lic
echo "${{ secrets.PCT_LICENSE_FILE }}" > pct.lic
kubectl create secret generic pct-license --from-file=pct.lic --namespace posit-test
rm pct.lic
echo "${{ secrets.PPM_LICENSE_FILE }}" > ppm.lic
kubectl create secret generic ppm-license --from-file=ppm.lic --namespace posit-test
rm ppm.lic
# no allow-failure until https://github.com/actions/toolkit/issues/399
- name: Run chart-testing (install changed)
id: ct-install
if: ${{ github.ref != 'refs/heads/main' && steps.list-changed.outputs.changed == 'true' }}
run: ct install --target-branch main --chart-dirs charts --chart-dirs other-charts --excluded-charts rstudio-library --namespace posit-test
continue-on-error: true
# no allow-failure until https://github.com/actions/toolkit/issues/399
- name: Run chart-testing (install all)
id: ct-install-all
run: ct install --target-branch main --all --chart-dirs charts --chart-dirs other-charts --excluded-charts rstudio-library --namespace posit-test
continue-on-error: true
- name: Notify Slack of chart install failure
if: steps.ct-install.outcome == 'failure' || steps.ct-install-all.outcome == 'failure'
uses: slackapi/[email protected]
with:
payload-delimiter: "_"
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Failure during test installation of ${{ steps.ct-install.outcome == 'failure' && 'changed' || 'all' }} charts. ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
- name: Fail the workflow if failed installs
if: steps.ct-install.outcome == 'failure' || steps.ct-install-all.outcome == 'failure'
run: exit 1
check-versions-connect:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/[email protected]
with:
version: v3.6.3
- uses: extractions/setup-just@v2
- name: Run executable verification for default interpreters
run: |
just test-connect-interpreter-versions