-
Notifications
You must be signed in to change notification settings - Fork 40
390 lines (364 loc) · 14.9 KB
/
sub_ui.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
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
# This workflow is a reusable one called by other workflows
name: (template) Elemental E2E UI tests
on:
workflow_call:
# Variables to set when calling this reusable workflow
inputs:
boot_type:
required: true
type: string
ca_type:
required: true
type: string
cert-manager_version:
required: true
type: string
cluster_name:
required: true
type: string
cluster_namespace:
required: true
type: string
cluster_type:
required: true
type: string
cypress_tags:
required: true
type: string
elemental_ui_version:
required: true
type: string
k8s_downstream_version:
required: true
type: string
k8s_upstream_version:
required: true
type: string
operator_install_type:
required: true
type: string
operator_repo:
required: true
type: string
os_to_test:
required: true
type: string
os_version_install:
required: true
type: string
os_version_target:
required: true
type: string
proxy:
required: true
type: string
public_domain:
required: true
type: string
public_fqdn:
required: true
type: string
qase_project_code:
required: true
type: string
qase_run_id:
required: true
type: string
rancher_git_chart:
required: true
type: string
rancher_version:
required: true
type: string
runner_label:
required: true
type: string
ui_account:
required: true
type: string
upgrade_from_version:
required: true
type: string
upgrade_image:
required: true
type: string
upgrade_os_channel:
required: true
type: string
# Job outputs to export for caller workflow
outputs:
steps_status:
description: Status of the executed test jobs
value: ${{ jobs.ui.outputs.steps_status }}
# Variables to set when calling this reusable workflow
secrets:
qase_api_token:
jobs:
ui:
runs-on: ${{ inputs.runner_label }}
outputs:
# For this to work 'id:' in steps are mandatory!
steps_status: ${{ join(steps.*.conclusion, ' ') }}
env:
CLUSTER_NAME: ${{ inputs.cluster_name }}
CLUSTER_NS: ${{ inputs.cluster_namespace }}
CYPRESS_TAGS: ${{ inputs.cypress_tags }}
# QASE variables
QASE_API_TOKEN: ${{ secrets.qase_api_token }}
QASE_PROJECT_CODE: ${{ inputs.qase_project_code }}
QASE_RUN_ID: ${{ inputs.qase_run_id }}
# K3S / RKE2 flags to use for installation
INSTALL_K3S_SKIP_ENABLE: true
INSTALL_K3S_VERSION: ${{ inputs.k8s_upstream_version }}
INSTALL_RKE2_VERSION: ${{ inputs.k8s_upstream_version }}
K3S_KUBECONFIG_MODE: 0644
# Distribution to use to host Rancher Manager (K3s or RKE2)
K8S_UPSTREAM_VERSION: ${{ inputs.k8s_upstream_version }}
# For K8s cluster to provision with Rancher Manager
K8S_DOWNSTREAM_VERSION: ${{ inputs.k8s_downstream_version }}
OPERATOR_INSTALL_TYPE: ${{ inputs.operator_install_type }}
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
- name: Get Epoch time
id: date
shell: bash
run: echo "epoch=$(date +'%s')" >> ${GITHUB_OUTPUT}
- name: Setup Go
id: setup_go
uses: actions/setup-go@v5
with:
cache-dependency-path: tests/go.sum
go-version-file: tests/go.mod
- name: Define needed system variables
id: define_sys_vars
run: |
# Add missing PATH, removed in recent distributions for security reasons...
echo "/usr/local/bin" >> ${GITHUB_PATH}
- name: Deploy Proxy
id: proxy
if: ${{ inputs.proxy == 'elemental' || inputs.proxy == 'rancher' }}
run: docker run -d --name squid_proxy -v $(pwd)/tests/assets/squid.conf:/etc/squid/squid.conf -p 3128:3128 wernight/squid
- name: Install Rancher Manager and Elemental
id: install_rancher_elemental
env:
CA_TYPE: ${{ inputs.ca_type }}
CERT_MANAGER_VERSION: ${{ inputs.cert-manager_version }}
OPERATOR_REPO: ${{ inputs.operator_repo }}
PROXY: ${{ inputs.proxy }}
PUBLIC_FQDN: ${{ inputs.public_fqdn }}
PUBLIC_DOMAIN: ${{ inputs.public_domain }}
RANCHER_VERSION: ${{ inputs.rancher_version }}
run: cd tests && make e2e-install-rancher
- name: Extract component versions/informations
id: component
run: |
# Extract CertManager version
CERT_MANAGER_VERSION=$(kubectl get pod \
--namespace cert-manager \
-l app=cert-manager \
-o jsonpath={.items[*].status.containerStatuses[*].image} 2> /dev/null || true)
# Extract Rancher Manager version
RANCHER_VERSION=$(kubectl get pod \
--namespace cattle-system \
-l app=rancher \
-o jsonpath={.items[*].status.containerStatuses[*].image} 2> /dev/null || true)
# Export values
echo "cert_manager_version=${CERT_MANAGER_VERSION}" >> ${GITHUB_OUTPUT}
echo "rancher_image_version=${RANCHER_VERSION}" >> ${GITHUB_OUTPUT}
- name: Install Chartmuseum
id: install_chartmuseum
if: ${{ inputs.operator_repo != 'marketplace' }}
env:
OPERATOR_REPO: ${{ inputs.operator_repo }}
OS_TO_TEST: ${{ inputs.os_to_test }}
run: |
cd tests && make e2e-install-chartmuseum
# Extract latest dev operator version
OPERATOR_CHART=$(ls elemental-operator-chart* 2>/dev/null)
i=${OPERATOR_CHART##*-}
OPERATOR_VERSION=${i%.tgz}
# Export value
echo "chartmuseum_operator_version=${OPERATOR_VERSION}" >> ${GITHUB_OUTPUT}
# Basics means tests without an extra elemental node needed
- name: Cypress tests - Basics
id: cypress_basics
env:
BOOT_TYPE: ${{ inputs.boot_type }}
BROWSER: chrome
CHARTMUSEUM_REPO: http://${{ inputs.public_fqdn }}
CYPRESS_DOCKER: 'cypress/included:13.9.0'
CYPRESS_TAGS: ${{ inputs.cypress_tags }}
ELEMENTAL_UI_VERSION: ${{ inputs.elemental_ui_version }}
K8S_UPSTREAM_VERSION: ${{ inputs.k8s_upstream_version }}
OPERATOR_REPO: ${{ inputs.operator_repo }}
OS_VERSION_INSTALL: ${{ inputs.os_version_install }}
OS_VERSION_TO_TEST: ${{ inputs.os_to_test }}
RANCHER_CHANNEL: ${{ inputs.rancher_version }}
RANCHER_GIT_CHART: ${{ inputs.rancher_git_chart }}
RANCHER_VERSION: ${{ steps.component.outputs.rancher_image_version }}
RANCHER_PASSWORD: rancherpassword
RANCHER_URL: https://${{ inputs.public_fqdn }}/dashboard
RANCHER_USER: admin
SPEC: |
/workdir/e2e/unit_tests/first_connection.spec.ts
/workdir/e2e/unit_tests/elemental_operator.spec.ts
/workdir/e2e/unit_tests/elemental_plugin.spec.ts
/workdir/e2e/unit_tests/user.spec.ts
/workdir/e2e/unit_tests/menu.spec.ts
/workdir/e2e/unit_tests/os_version.spec.ts
/workdir/e2e/unit_tests/machine_registration.spec.ts
/workdir/e2e/unit_tests/seed_image.spec.ts
/workdir/e2e/unit_tests/advanced_filtering.spec.ts
UI_ACCOUNT: ${{ inputs.ui_account }}
UPGRADE_FROM_VERSION: ${{ inputs.upgrade_from_version }}
UPGRADE_OS_CHANNEL: ${{ inputs.upgrade_os_channel }}
run: cd tests && make start-cypress-tests
- name: Upload Cypress screenshots (Basics)
id: upload_screenshots_cypress_basics
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
# Use PUBLIC_FQDN to avoid issue with parallel jobs, as it is unique
name: cypress-screenshots-basics-${{ inputs.public_fqdn }}-${{ steps.date.outputs.epoch }}
path: tests/cypress/latest/screenshots
retention-days: 7
if-no-files-found: ignore
- name: Upload Cypress videos (Basics)
id: upload_videos_cypress_basics
# Test run video is always captured, so this action uses "always()" condition
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
# Use PUBLIC_FQDN to avoid issue with parallel jobs, as it is unique
name: cypress-videos-basics-${{ inputs.public_fqdn }}-${{ steps.date.outputs.epoch }}
path: tests/cypress/latest/videos
retention-days: 7
- name: Extract Elemental version
id: elemental_version
run: |
# Extract elemental-operator version
OPERATOR_VERSION=$(kubectl get pod \
--namespace cattle-elemental-system \
-l app=elemental-operator \
-o jsonpath={.items[*].status.containerStatuses[*].image} 2> /dev/null || true)
# Export value
echo "operator_version=${OPERATOR_VERSION}" >> ${GITHUB_OUTPUT}
- name: Deploy nodes to join Rancher manager
id: deploy_node_ui
env:
BOOT_TYPE: ${{ inputs.boot_type }}
POOL: master
VM_MEM: 10240
VM_CPU: 6
run: |
cd tests && (
# Removing 'downloads' is needed to avoid this error during 'make':
# 'pattern all: open .../elemental/tests/cypress/downloads: permission denied'
sudo rm -rf cypress/latest/downloads
# Enable multi-nodes only for main scenario
if ${{ contains(inputs.cypress_tags, 'main') }}; then
export VM_NUMBERS=3
else
export VM_NUMBERS=1
fi
VM_INDEX=1 make e2e-ui-rancher
)
# Advanced means tests which needs an extra elemental node (provisioned with libvirt)
- name: Cypress tests - Advanced
id: cypress_advanced
env:
BOOT_TYPE: ${{ inputs.boot_type }}
BROWSER: firefox
CHARTMUSEUM_REPO: http://${{ inputs.public_fqdn }}
CYPRESS_DOCKER: 'cypress/included:13.9.0'
CYPRESS_TAGS: ${{ inputs.cypress_tags }}
ELEMENTAL_DEV_VERSION: ${{ steps.install_chartmuseum.outputs.operator_dev_version }}
ELEMENTAL_UI_VERSION: ${{ inputs.elemental_ui_version }}
OPERATOR_REPO: ${{ inputs.operator_repo }}
OS_VERSION_TARGET: ${{ inputs.os_version_target }}
PROXY: ${{ inputs.proxy }}
RANCHER_VERSION: ${{ steps.component.outputs.rancher_image_version }}
RANCHER_PASSWORD: rancherpassword
RANCHER_URL: https://${{ inputs.public_fqdn }}/dashboard
RANCHER_USER: admin
SPEC: |
/workdir/e2e/unit_tests/machine_selector.spec.ts
/workdir/e2e/unit_tests/machine_inventory.spec.ts
/workdir/e2e/unit_tests/reset.spec.ts
/workdir/e2e/unit_tests/deploy_app.spec.ts
/workdir/e2e/unit_tests/upgrade-operator.spec.ts
/workdir/e2e/unit_tests/upgrade-ui-extension.spec.ts
/workdir/e2e/unit_tests/upgrade.spec.ts
UI_ACCOUNT: ${{ inputs.ui_account }}
UPGRADE_IMAGE: ${{ inputs.upgrade_image }}
UPGRADE_OS_CHANNEL: ${{ inputs.upgrade_os_channel }}
run: cd tests && make start-cypress-tests
- name: Upload Cypress screenshots (Advanced)
id: upload_screenshots_cypress_advanced
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
# Use PUBLIC_FQDN to avoid issue with parallel jobs, as it is unique
name: cypress-screenshots-advanced-${{ inputs.public_fqdn }}-${{ steps.date.outputs.epoch }}
path: tests/cypress/latest/screenshots
retention-days: 7
if-no-files-found: ignore
- name: Upload Cypress videos (Advanced)
id: upload_videos_cypress_advanced
# Test run video is always captured, so this action uses "always()" condition
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
# Use PUBLIC_FQDN to avoid issue with parallel jobs, as it is unique
name: cypress-videos-advanced-${{ inputs.public_fqdn }}-${{ steps.date.outputs.epoch }}
path: tests/cypress/latest/videos
retention-days: 7
- name: Extract ISO version
id: iso_version
if: ${{ always() }}
run: |
# Extract OS version from ISO
ISO=$(file -Ls *.iso 2>/dev/null | awk -F':' '/boot sector/ { print $1 }')
if [[ -n "${ISO}" ]]; then
# NOTE: always keep 'initrd' at the end, as there is always a link with this name
for INITRD_NAME in elemental.initrd* initrd; do
INITRD_FILE=$(isoinfo -i ${ISO} -R -find -type f -name ${INITRD_NAME} -print 2>/dev/null)
if [[ -n "${INITRD_FILE}" ]]; then
isoinfo -i ${ISO} -R -x ${INITRD_FILE} 2>/dev/null \
| xz -dc \
| cpio -i --to-stdout usr/lib/initrd-release > os-release
eval $(grep IMAGE_TAG os-release 2>/dev/null)
# We found an initrd, stop here
break
fi
done
fi
# Export value (even if empty!)
echo "os_version=${IMAGE_TAG}" >> ${GITHUB_OUTPUT}
# This step must be called in each worklow that wants a summary!
- name: Get logs and add summary
id: logs_summary
if: ${{ always() }}
uses: ./.github/actions/logs-and-summary
with:
ca_type: ${{ inputs.ca_type }}
cert_manager_version: ${{ steps.component.outputs.cert_manager_version }}
cluster_type: ${{ inputs.cluster_type }}
elemental_ui_version: ${{ inputs.elemental_ui_version }}
k8s_downstream_version: ${{ inputs.k8s_downstream_version }}
k8s_upstream_version: ${{ inputs.k8s_upstream_version }}
node_number: ${{ inputs.node_number }}
operator_version: ${{ steps.elemental_version.outputs.operator_version }}
os_version: ${{ steps.iso_version.outputs.os_version }}
proxy: ${{ inputs.proxy }}
public_fqdn: ${{ inputs.public_fqdn }}
rancher_image_version: ${{ steps.component.outputs.rancher_image_version }}
rancher_version: ${{ inputs.rancher_version }}
sequential: ${{ inputs.sequential }}
steps_status: ${{ join(steps.*.conclusion, ' ') }}
test_type: ${{ inputs.test_type }}
ui_account: ${{ inputs.ui_account }}
upgrade_image: ${{ inputs.upgrade_image }}
upgrade_os_channel: ${{ inputs.upgrade_os_channel }}